What exactly is being serialized when you perform serialization in .net?



What exactly is being serialized when you perform serialization in .net?..

Answer / 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

More Dot Net General Interview Questions

Is atl redundant in the .net world?

1 Answers  


How to load the contents of an xml file into an xmldocument object?

1 Answers  


What are the authentication methods in .net?

1 Answers  


How to create multiple inheritance in c#, with example?

1 Answers  


What does stateless mean?

1 Answers   BirlaSoft,


What is JIT and how is works?

3 Answers  


Tell us what is the difference between struct and class?

1 Answers  


Will my .net app run on 64-bit windows?

1 Answers  


How is a managed code executed?

2 Answers  


Is .net front end or backend?

1 Answers  


What is managed code execution?

1 Answers  


what is AGILE SCRUM methodoly....?

1 Answers  


Categories