简体   繁体   中英

How do I do typeof(int) in Managed C++?

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!

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

eg

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM