Access modifiers in .Net

Abhays
 
on Aug 08, 2018 01:05 AM
2087 Views

I am new to C#.i wanted to know about Public,private,protected keyword using simple example.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Aug 08, 2018 01:09 AM

Hi Abhays,

Access modifiers are keywords used to specify the declared accessibility of a member or a type.

The following six accessibility levels can be specified using the access modifiers.

  • public: Access is not restricted.
  • protected: Access is limited to the containing class or types derived from the containing class.
  • internal: Access is limited to the current assembly.
  • protected internal: Access is limited to the current assembly or types derived from the containing class.
  • private: Access is limited to the containing type.
  • private protected: Access is limited to the containing class or types derived from the containing class within the current assembly.

For more details refer below link.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/access-modifiers