Access Modifiers
Hi
Iam new to .NET and iam beginning to learn it.
what are the different access modifiers used in C# and their use ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tuhin PaulPosted Mar 16, 2023, 2:38 PM
There are five access modifiers in C#:
Rajeev KumarPosted Mar 16, 2023, 10:09 AM
Access is limited to the containing class or types derived from the containing class within the current assembly.
Jignesh TrivediPosted Feb 25, 2015, 11:30 PM
Hi,
Agree with Vulpes there are five access modifier.
Please refer
https://msdn.microsoft.com/en-us/library/ms173121.aspx
hope this will help you.
VulpesPosted Feb 25, 2015, 3:26 PM
This is the union of protected and internal access.
The CLR supports a sixth access modifier, known as 'famandassem', which is the intersection of protected and internal access but this isn't supported by either C# or VB.NET. However, it is supported in C++/CLI where it's called 'private protected'.
Pradeep ShetPosted Feb 25, 2015, 2:22 AM
There are mainly 4 access modifier available in C#.
Public => which allow you to get accessed every where the code.
Private => which allow you to get accessed within its own class
protected=>which allow you to get accessed in its own class & immediate inherited class.
Internal => access limited to current assembly or library.
PradeepPosted Feb 25, 2015, 1:12 AM
Please reffer the link for the details
https://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx
AdministratorPosted Feb 19, 2003, 1:31 PM