O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Serializing delegates

Delegates implement the ISerializable interface so that the Delegate class can be persisted in a serialized form. Serialization is a topic that will be developed more fully in Chapter 17, but for now just note that the class can be persisted to a file, either as text (SoapFormatter) or as a binary image (BinaryFormatter). The BinaryFormatter produces considerably less data than the SoapFormatter, but it is proprietary to Microsoft and it is not very readable. Your application might require the BinaryFormatter, but this chapter will focus on the SoapFormatter. Changing from one formatter to another is simple.

Listing 14.20 shows a delegate being serialized to a file “static-delegate.xml” and then deserialized from that same ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required