How should I use properties when dealing with read-only List members

后端 未结 7 1511
栀梦
栀梦 2020-12-01 08:26

When I want to make a value type read-only outside of my class I do this:

public class myClassInt
{
    private int m_i;
    public int i {
        get { ret         


        
7条回答
  •  天命终不由人
    2020-12-01 09:19

    Eric Lippert has a series of articles on Immutability In C# on his blog.

    The first article in the series can be found here.

    You might also find useful Jon Skeet's answer to a similar question.

提交回复
热议问题