P
phancey
I want to define a class like this
[DataContract]
class MyClass
{
[DataMember]
List<T> MyList<T> where T : IMyList {get; set;}
}
or something like this. I don't want to put <T> on my class definition
because it is only after the instance has been created that I will
know exactly which type of object MyList will use. And I want the
DataContractSerializer to serialize the object straightforwardly so I
want it to remain a Property rather than a method.
But I can't seem to declare it like this. I have tried a few
variations. Is there a solution that is simple or is it not possible?
thanks
Phil
[DataContract]
class MyClass
{
[DataMember]
List<T> MyList<T> where T : IMyList {get; set;}
}
or something like this. I don't want to put <T> on my class definition
because it is only after the instance has been created that I will
know exactly which type of object MyList will use. And I want the
DataContractSerializer to serialize the object straightforwardly so I
want it to remain a Property rather than a method.
But I can't seem to declare it like this. I have tried a few
variations. Is there a solution that is simple or is it not possible?
thanks
Phil