Jan 21, 2010

When a constructor is not called

Normally, when we build a .net object, clr will call the constructor.
But In a few situations, an instance of a type can be created without an instance constructor being called. In particular, calling Object's MemberwiseClone method allocates memory, initializes the object's overhead fields, and then copies the source object's bytes to the new object. Also, a constructor is usually not called when deserializing an object.

No comments:

Post a Comment