adspace
What exactly is being serialized when you perform serialization in .net?
Answer Posted / Kishor Kumar
During serialization in .NET, an object graph (a collection of interconnected objects) is converted into a format that can be stored or transmitted. The exact data being serialized depends on the serializer's implementation and settings but typically includes all public properties, fields, and any referenced child objects.nnExample:nn```csharpnusing System.Runtime.Serialization;nclass Program {n static void Main() {n var person = new Person { Name = "John", Age = 30 };n var formatter = new BinaryFormatter();n using (var stream = new FileStream("person.dat", FileMode.Create)) {n formatter.Serialize(stream, person);n }n }n}nclass Person : ISerializable {n public string Name { get; set; } n public int Age { get; set; } n}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers