Access Specifier
Type - (Class, Constructor, Interface, Delegate etc)
Type member - ( property, method, field etc)
There are 5 Access Specifier.
1. Public :-
When a property/ attribute or method is declared Public, it can be accessed from anywhere in a class.
2. Private :-
When a property/ attribute or method is declared Private, it can be accessed from within a class.
3. Internal :-
When a property or method is defined as Internal, it can be accessible from within assembly (current) assembly point of that class.
4. Protected :-
When a user declares a method or attribute as Protected, it can only be accessed by members of that class and those who inherit it.
5. Protected Internal :-
When a user declares a method or attribute as Protected Internal, accessible from within assembly and outside the assembly those who inherit
- internal: Accessible only within the same project.
- protected: Accessible only within the class and its child classes.
- protected internal: Accessible within the project and by child classes outside the project.
*========Simple way=======*
Dusre project me use krna ho to Public & Protected Internal ka use kare
No comments: