33

I am working on a project now and part of it uses Managed C++. In the managed C++ code, I am creating a DataTable. While defining the Columns for the datatable, I need to specify the Type of the column. In C#, that would:

typeof(int)

but how do I do that in Managed C++?

Thanks!

Daniel Earwicker
  • 114,894
  • 38
  • 205
  • 284
Nazeeh
  • 631
  • 1
  • 6
  • 13
  • 2
    for future reference... if you want to see Managed Language equivalents, you can simple write the code in C#, and use Redgate Reflector to dissamble it into any CLR language. – Brian Rudolph Jul 15 '09 at 19:48

1 Answers1

67

In C++/CLI, use the typeid keyword.

e.g.

Type ^t = Int32::typeid;

In the older "Managed C++ Extensions" syntax, you'd use __typeof(Int32), but that whole version of the language is severely deprecated and you should be using C++/CLI.

Daniel Earwicker
  • 114,894
  • 38
  • 205
  • 284