What can I do with a protected/private static variable?

前端 未结 7 2277
悲&欢浪女
悲&欢浪女 2021-01-01 18:00

I see I can write :

protected static

in my C# class (in my case, an aspx.cs). As well as :

private static

7条回答
  •  一整个雨季
    2021-01-01 18:38

    Use protected if you only want the variable to be accessible through certain classes, for instance when using polymorphism and inheritance. Public makes it always visible within the scope and private is pretty obvious.

提交回复
热议问题