I have one class with a generic type, like this:
public class Test<T> {
/*
Some Properties and Fields
*/
}
Now I need a public Property SubTest{T} in class Test{T} with datatype Test{T}
public class Test<T> {
/*
Some Properties and Fields
*/
public Test<T> SubTest { get; set; }
}
T and U are not the same datatype and SubTest can be null. Is that possible in C#?
Update Or like This?
public class Test {
/*
Some Properties and Fields
*/
public Type ElementType { get; private set; }
public Test SubTest { get; set; }
public Test(Type elementType) {
ElementType = elementType;
}
}