What's the C++/CLI equivalent of C#'s readonly
keyword?
Specifically, how do you write a public or protected member of a C++/CLI class such that it is readonly
when referenced from C#?
The . NET framework can work with several programming languages such as C#, VB.NET, C++ and F#.
gcnew is an operator, just like the new operator, except you don't need to delete anything created with it; it's garbage collected. You use gcnew for creating . Net managed types, and new for creating unmanaged types.
C++ is a object oriented programming language. But here . Net is a framework which supports multiple languages to build applications using . net class libraries which will be excueted via CLR .
I just found out (thanks to Literal field versus constant variable in C++/CLI) that
const
is literal
in C++/CLI, andreadonly
is initonly
in C++/CLIIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With