Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top