Hello everyone,
I am migrated from C++ to C#. I am reading through about C++ template class and C# generics' differences,
http://msdn.microsoft.com/en-us/library/c6cyy67b(VS.80).aspx
3 questions,
1.
"At the implementation level, the primary difference is that C# generic type substitutions are performed at runtime and generic type information is thereby preserved for instantiated objects."
"preserved for instantiated objects" means?
2.
"In C#, a generic type parameter cannot itself be a generic, although constructed types can be used as generics. C++ does allow template parameters."
"constructed types" means?
3.
What means "C# disallows this; the only language constructs allowed are those that can be deduced from the constraints."?
thanks in advance,
George
George GeorgePosted May 11, 2008, 7:03 AM
Thanks Bechir,
1.
From your comments, I think "preserved for instantiated objects" means the information of the generics type parameter information is filled at runtime, and preserved at compile time?
2.
Your reply about (2) is great! But my confusion is about "constructed types can be used as generics", what does it mean?
3.
About your reply for my question (3), I am confused. Where do you find base class related context/discussion in the paragraph where I have question? :-)
regards,
George
Bechir BejaouiPosted May 11, 2008, 6:43 AM
1.
"At the implementation level, the primary difference is that C# generic type substitutions are performed at runtime and generic type information is thereby preserved for instantiated objects."
"preserved for instantiated objects" means?
2.
"In C#, a generic type parameter cannot itself be a generic, although constructed types can be used as generics. C++ does allow template parameters."
"constructed types" means?
3.
What means "C# disallows this; the only language constructs allowed are those that can be deduced from the constraints."?
thanks in advance,
George