How to create an object without invoking constructor in

 Posted by Prabhat39 on 5/8/2013 | Category: C# Interview questions | Views: 1839 | Points: 40

FormatterServices.GetUninitializedObject(Type) is a method through which we can creates a new instance of the specified object type without invoking constructor. Even if the constructor is declared as private we can able to create object outside of the class. Because the new instance of the object is initialized to zero and no constructors are run.

Note: You cannot use the GetUninitializedObject method to create instances of types that derive from the ContextBoundObject class.

Asked In: Some Interviews | Alert Moderator 

Comments or Responses

Login to post response

More Interview Questions by Prabhat39