Chris,
While the previous two posters are right about generics, it should be
noted that there will be a few limitations, and they are not exactly like
templates. The biggest advantage of Generics is that Generic type
definitions are created at run-time, not at compile time (unlike the C++ and
Java models) so that a List<T> is a List<T> everywhere and can be used
everywhere.
However, the major con is that you can not do something like this:
public class MyClass<T> : T
{
public void DoSomething()
{
this.CallAMethodOnT();
}
}
You can't do that kind of thing with Generics, like you could with C++
templates.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Christoph" <jc*****@yahoo.com> wrote in message
news:O6**************@TK2MSFTNGP10.phx.gbl...
I'm curious if C# has the equivalent of a template class in C++.
Where, in C++, you can do something like the following:
CList<int> myList;
CList<byte> myList;
etc.
thnx,
Chris