Cum Grano Salis

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"

[Guid(MyClass::Guid)]
ref class MyClass
{
   public:
   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).

Published Saturday, July 15, 2006 11:18 AM by Shahar
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

C++/CLI equivalent of the C# const keyword » Wagalulu - Microsoft » » C++/CLI equivalent of the C# const keyword said:

July 15, 2006 2:52 PM
 

Cum Grano Salis said:

I recently posted about the C++/CLI equivalent keyword for the C# const. Reason for the post was that...
July 20, 2006 8:10 PM
 

Rob Ashton said:

Thanks, picked you up from Google - lifesaver.

December 1, 2007 6:43 PM
 

rahul said:

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

http://CSharpTalk.com

Thanks again

Rahul

December 23, 2009 5:42 AM

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker