I'm doing something like this:
public abstract class FolderNode<TChildNode,TChildBusObj> : Node
where TChildNode : MappedNode<TChildBusObj>, new()
where TChildBusObj : new()
{
..
}
Is there a way of omitting TChildBusObj from the definition, but still be able access it in the code? E.g. I want to be able to infer the generic type of a generic type. I tried this:
public abstract class FolderNode<TChildNode> : Node
where TChildNode : MappedNode<TChildBusObj>, new()
{
..
}
but I get this compile error:
CS0246: The type or namespace name 'TChildBusObj' could not be found (are you missing a using directive or an assembly reference?)
Update 22/01
I've actually determined I want this:
public class Folder<TChildNode, TBusObj> : MappedNode<TBusObj[]>
where TChildNode : MappedNode<TBusObj>, new()
which it would be nice to shorten to this:
public class Folder<MappedNode<TBusObj>, TBusObj> : MappedNode<TBusObj[]>
But I can't because I get this error:
CS0081: Type parameter declaration must be an identifier not a type
I guess you cannot anonymize nested generic types in the class definition