I am trying to Serialise the class 'Person', which contains a property where the type is an interface.
I a getting an exception - System.NotSupportedException - saying ----> System.NotSupportedException : Cannot serialize member Tests.Person.Names of type Writer.Tests.INames because it is an interface.
Is there a way round this? Or just simply can not be done.
public interface INames
{
string First { get; set; }
string Last { get; set; }
}
public class Names : INames
{
public string First { get; set; }
public string Last { get; set; }
}
public class Person
{
public INames Names { get; set; }
public double WeightKg { get; set; }
public double HeightCm { get; set; }
}