FANDOM


CSharp

Hello, people!

In C# and in many other langauges are very important to define visibility level of a class, a method, a variable or a property.

Some of them might not feel that relevant to you right now, you can always come back to this page and read this article again.


PublicEdit

The member can be reached from anywhere. This is the least restrictive visibility. Enums and interfaces are publicly visible.

ProtectedEdit

Members can only be reached from within the same class, or from a class which inherits from this class.

InternalEdit

Members can be reached from within the same project only.

Protected InternalEdit

Same as internal, except that also classes which inherits from this class can reach it members, even from another project.

PrivateEdit

Can only be reached by members from the same class.

This is the most restrictive visibility.

Classes and structs are set to private visibility.