Access rights C# with Example



Access rights C# with Example

// static: is callable on a class even when no instance of the class has been created 
public static void MyMethod() 
// virtual: can be called or overridden in an inherited class 
public virtual void MyMethod() 
// internal: access is limited within the current assembly 
internal void MyMethod() 
//private: access is limited only within the same class 
private void MyMethod() 
//public: access right from every class / assembly 
public void MyMethod() 
//protected: access is limited to the containing class or types derived from it 
protected void MyMethod() 
//protected internal: access is limited to the current assembly or types derived from the containing 
class. 
protected internal void MyMethod() 
 

Parameter Details 
The first parameter of an extension method should always be preceded by the this keyword, followed 
this 
by the identifier with which to refer to the "current" instance of the object you are extending 

0 Comment's

Comment Form

Submit Comment