Tutorial :in c# are methods private by default?


If I have a method that does not specify its Accessibility Level will it be Private by default?

void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)  {      throw new NotImplementedException();  }          

Is the above method private?


It is. The general rule if you don't define any modifier is "the most restricted modifier that can be applied here is used", so private for methods, internal for top-level classes, etc.


Yes, it is private.


For a method inside a class, default is private. It does vary based on the scope of where things are declared, here's an MSDN link with more specifics

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »