internal protected property still accessible from a different assembly

前端 未结 8 971
清酒与你
清酒与你 2021-02-07 09:40

I\'m setting up some demo code for a beginner session on accessibility and I found that I am able to access an internal protected property from a derived class. What am I missin

8条回答
  •  -上瘾入骨i
    2021-02-07 10:29

    Late answer but I got caught with the same issue. Eventualy I came up with a partial solution.

        internal Int MyInt
        {
            get;
            protected set;
        }
    

    It is still visible within the assembly but at least only inherithing classes can actualy change it. It is enough for what I wanted.

提交回复
热议问题