Hi,
I want to create a template class in C#, for example:
public class Foo<T>
where T must inherit from a known class.
I cant seem to find the syntax for that.
Thanks, Malki.
Hi,
I want to create a template class in C#, for example:
public class Foo<T>
where T must inherit from a known class.
I cant seem to find the syntax for that.
Thanks, Malki.
In .NET the term generic class
is used instead of template class
. And what you are trying to do is called generic constraints:
public class Foo<T> where T : KnownClass
{
}