Reputation: 1990
In C++ you can write:
private:
int w;
string x;
protected:
int y;
string z;
is there something similar in C# ?
Upvotes: 2
Views: 891
Reputation: 7583
You could define your region with #region Private...#endregion
, #region Protected...#endregion
etc.
Upvotes: -2
Reputation: 241711
No, there are no regions with a specific access type in C#. Every member of a class
or struct
must have an explicit access modifier or accept the default access modifier private
.
Also, on the topic of access modifiers in C# compared to C++, C# has two additional modifiers internal
and protected internal
. The modifier internal
means that it is visible only within the defining assembly and protected internal
means protected
or internal
(NOT protected
and internal
).
Upvotes: 12
Reputation: 8926
you can't but see this it could help
private int x,y,z; private string x,y,z
Upvotes: 2