In MC++, one could obtain a Type* representing a given class at compile time by using __typeof. In C++/CLI you access the Type as a pseudo-static member of the class you're interested in (this is not really how it is described in the language spec, but it looks remarkably similar from a developer point of view, at least imho), like this:
Type^ stringType = String::typeid;
Console::WriteLine(stringType->FullName);
Do keep in mind that the T::typeid for is actually a compile time expression, not something that's evaluated at runtime.
It also works on generics:
generic <typename T>
ref class MyGeneric
{
public:
void PrintTypes()
{
Type^ tType = T::typeid;
Console::WriteLine(tType->FullName);
}
};
.: tomasr | 2004-12-12 09:06:39 :.