I am using the Json.Net library to convert objects to json and back to objects.
I have an interface:
public interface IGoods { List<IPen> Pens { get; set; } List<IPencil> Pencils{ get; set; } void Deserialize(String json); }
implementation:
new public void Deserialize(String json) { JsonConvert.DeserializeObject<Goods>(json); }
Obvious error I received: Failed to create an instance of type Project.IPen. A type is an interface or an abstract class and cannot be created.
How to overcome this error?
Thanks!
source share