C++/CLI equivalent of the C# const keyword

Writing this just post because searching the string “C++/CLI” const equivalent on a search engine did not find what I was looking for.

The answer is, by the way, “literal”

ref class MyClass
   literal String^ Guid = “6C46D25A-BB4C-4bf9-8B26-F78D98C4BC18”;

(initonly which is the equivalent of readonly in C++/CLI will not work because it would not be usable as a parameter to an attribute).

Comments (4)

  1. I recently posted about the C++/CLI equivalent keyword for the C# const. Reason for the post was that…

  2. Rob Ashton says:

    Thanks, picked you up from Google – lifesaver.

  3. rahul says:

    First of all. Thanks very much for your useful post.

    I just came across your blog and wanted to drop you a note telling you how impressed I was with the

    information you have posted here.

    Please let me introduce you some info related to this post and I hope that it is useful for community.

    There is a good C# resource site, Have alook


    Thanks again