Monday, February 21, 2011

Do I still write String^ const in C++/CLI

In C++ it's recommended to have const-correctness everywhere. But since in .Net world, the string content cannot be changed, (new string will be created), do I still write String^ const?

From stackoverflow
  • No. Just pass a handle to a string directly: method(String^ string)

    AZ : ok, what if in a method, I want to define a const string, would it be better that I put const there so anyone else would know it's a not-changed string?

0 comments:

Post a Comment