O'Reilly logo

Windows Forms Programming in C# by Chris Sells

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

Formatters

A formatter is an object that knows how to write arbitrary objects to a stream. A formatter exposes this functionality by implementing the IFormatter information from the System.Runtime.Serialization namespace:

interface IFormatter {
  // Properties
  SerializationBinder Binder { get; set; }
  StreamingContext Context { get; set; }
  ISurrogateSelector SurrogateSelector { get; set; }

  // Methods
  object Deserialize(Stream serializationStream);
					void Serialize(Stream serializationStream, object graph);
}

A formatter has two jobs. The first is to serialize arbitrary objects, specifically their fields, including nested objects.[1] The formatter knows which fields to serialize using Reflection,[2] which is the .NET API for finding out type information ...

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