I don't think deserializing objects requires a parameterless constructor. I think Richter discuss this in CLR via C# and tells us that deserialized objects don't even have the ctor run. Can anyone confirm my memory is not failing me? -- Greg K
On 25 October 2013 23:58, David Rhys Jones <[email protected]> wrote: > One of the developers here just asked a strange question that I don't know > the answer to. > > > imagine this class is > > [DataContract] > public class Orange : ResponseBase > { > public Orange(string color) > { > Color = color; > } > > public string Color { get; set; } > } > > In reflector ResponseBase is marked as Serializable and has a > Parameterless constructor. > > with a shared assembly between the web-service and the client. > > Orange can be serialized and then de-serialized in the client without a > parameterless constructor. > > What is going on? how is the object reconstructed or are we looking at > errors down the line if we change transport protocols. I'm guessing that > the object is being shared and not serialized? > > > Davy, > > "Every time I press one of these black controls, labelled in black on a > black background, a little black light lights up black to let me know I've > done it." Douglas Adams. > > >
