What is equivelant to VB.NET GetType()

  • Thread starter Thread starter Daniel Billingsley
  • Start date Start date
D

Daniel Billingsley

Using this keyword in VB I can do

Dim typeData As Type = GetType(myClass)

which returns a Type of course. I can't find quite the same thing in C# or
the framework.

Will the following meet the needs like the above VB code? (If so, then why
the keyword in VB???)

Type typeData = Type.GetType("myClass")
 
If "myClass" is the name of your class, you can use typeof(myClass). If
it's an instance of your class, you can use myClass.GetType().
 
Thanks to both of you, that worked poifect.

Pardon me for being a bit misleading... I should have used MyClass as I
indeed meant to refer to the class, not an instance object.
 
Back
Top