“const correctness” in C#

前端 未结 7 1474
执念已碎
执念已碎 2020-11-28 05:29

The point of const-correctness is to be able to provide a view of an instance that can\'t be altered or deleted by the user. The compiler supports this by pointing out when

7条回答
  •  星月不相逢
    2020-11-28 05:40

    I just wanted to note for you that many of the System.Collections.Generics containers have an AsReadOnly method which will give you back an immutable collection.

提交回复
热议问题