0

When you new an object in C# a few things must happen:

  1. memory for the object is created, and whatever other book-keeping CLR whats to do
  2. fields are initialized to default values
  3. the constructor is invoked

Serialization frameworks seem to have some magical way to do 1 without doing 2 and 3. Or maybe it's not so magical after all. How would you do the same (skip 2 and 3) if you are writing your own deserialization code?

1

1 Answer 1

0

Binary formatter uses methods of FormatterServices, like GetUninitializedObject.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.