Search code examples
c#access-modifiers

Is there a C# equivalent to access-modifier regions in C++


It's possible to declare variables with the below structure in C++

private:
public:
protected:
    float bla1;
    float bla2;
    float bla3;

Is there an equivalent in C#? It seems rather tedious having to repeat yourself;

protected float bla1;
protected float bla2;
protected float bla3;

Solution

  • No there isn't such a thing. In fact, it's designed to be like that to make code more readable. This applies to both C# and Java.