I have an object that i’ve serialised but I want to run a shuffling routine on the constructor will that extra function be run when the object is deserialized or do datacontracts not run the the constructor?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DataContractSerializer emits and eats XML. The default constructor is always invoked when deserializing this XML back to an instance of a class. So if you deserialize back to the same class the constructor code will be run.
But if you have exposed this class in a WCF webservice and generated a client proxy, then this client proxy will not have any of the custom code that you have written in the methods or constructors.