What for should I mark private variables as private if they already are?

前端 未结 10 1677
星月不相逢
星月不相逢 2021-01-06 18:43

As far as I know, in C# all fields are private for default, if not marked otherwise.

class Foo
{
  private string bar;
}

class Foo
{
  string bar;
}
         


        
10条回答
  •  别那么骄傲
    2021-01-06 19:42

    Up to you. Do what's best for readability or makes sense in your case. I mark them as private just to make it clear though.

提交回复
热议问题