I have the following classes and interfaces:
public interface IThing
{
string Name { get; }
}
public class Thing : IThing
{
public string Name { get
If you make ThingConsumer an interface rather than an abstract class, then your code will work as is.
public interface IThingConsumer where T : IThing
{
string Name { get; set; }
}
Edit
One more change needed. In ThingConsumerFactory, cast back to the return type IThingConsumer:
return (IThingConsumer)new MyThingConsumer();