Datacontract exception. Cannot be serialized

前端 未结 6 912
天命终不由人
天命终不由人 2021-01-01 08:28

I have the following WCF DataContract:

[DataContract]
public class Occupant
{
    private string _Name;
    private string _Email;
    private string _Organi         


        
6条回答
  •  庸人自扰
    2021-01-01 09:05

    You need a default parameterless constructor. I don't ever plan to actually use mine, so I added a summary for IntelliSense and throw a run-time exception to keep it from being used.

    /// 
    /// parameterless default constructor only for serialization
    /// 
    public MyClass() { throw new NotImplementedException("parameterless default constructor only for serialization"); }
    

提交回复
热议问题