c# - Using reflection to instantiate a class without running its constructor -
this question has answer here:
is possible this?
i have class validation logic in constructor. general use want enforce constructor.
however, when deserializing said class, want able bypass validation logic , reserve memory space without running construction routine (like malloc in c++).the properties mapped manually using reflection, after object has been instantiated. possible in c#?
you can use formatterservices.getuninitializedobject
Comments
Post a Comment