This project has moved. For the latest updates, please go here.

Why not using GetSafeUninitializedObject ( or GetUninitializedObject ) to create new objects?

Jul 18, 2012 at 5:35 PM

When a new object must be created is there any negative impact in using FormatterServices.GetSafeUninitializedObject instead of invoking the constructor?

By using the GetSafeUninitializedObject we will get the following benefits:

- the constructor will not be invoked so we get some performance increment

- if in the constructor there is some logic that do irreversible operations these operations will not be executed again (for example a DB update)