Encapsulation is sometimes referred to as the first pillar or principle of object-oriented programming. A class or struct can specify how accessible each of its members is to code outside of the class or struct.

Methods and variables that aren’t intended to be used from outside of the class or assembly can be hidden to limit the potential for coding errors or malicious exploits.

For more information, see the Object-oriented programming tutorial.

You will also hear the term ACCESSIBILITY MODIFIERS (public and private) related to this subject.

Read More about Encapsulation: https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/object-oriented/

Read More about Access Modifiers: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers

Back to Main CSharp Page