C#: can you make it so that a method parameter passes an object by reference but is read-only?
eg:
void MyMethod(int x, int y, read-only MyObject obj)
where obj is an object reference but this object cannot be modified during the method.
Can this be achieved in C#?
No. C# has no direct analogue to C++
const(its own const is something different). A common C# pattern for this is to pass in a interface, such asIEnumerable, that does not permit modifications. You can also create an immutable copy or wrapper.