I know we can only create instances of classes but I'd like to set an interface for my method and just creating an instance within my Deserialize() method:
public T Deserialize(string contents)
{
Type type = typeof(T);
var obj = Activator.CreateInstance(type);
I'd like to use it this way:
var customSerializer = new CustomSerializer<IPerson>();
IPerson person = customSerializer.Deserialize(contents);
It doesn't matter what object it creates, it just have to have the basic properties that my T interface provides.
How could I achieve this?
Thanks,