How to achieve const-correctness in C#?

c#, c++, const-correctness

Solution

There is an excellent blog post about this issue by Stan Lippman: A question of const

Problem

Possible Duplicate: “const correctness” in C# I have programmed C++ for many years but am fairly new to C#. While learning C# I found that the use of the const keyword is much more limited than in C++. AFAIK, there is, for example, no way to declare arguments to a function const. I feel uncomfortable with the idea that I may make inadvertent changes to my function arguments (which may be complex data structures) that I can only detect by testing. How do you deal with this situation?

Original source

Related problems