Tutorial by Examples

The public keyword makes a class (including nested classes), property, method or field available to every consumer: public class Foo() { public string SomeProperty { get; set; } public class Baz { public int Value { get; set; } } } public class Bar() { publ...
The private keyword marks properties, methods, fields and nested classes for use inside the class only: public class Foo() { private string someProperty { get; set; } private class Baz { public string Value { get; set; } } public void Do() { var ...
The internal keyword makes a class (including nested classes), property, method or field available to every consumer in the same assembly: internal class Foo { internal string SomeProperty {get; set;} } internal class Bar { var myInstance = new Foo(); internal string SomeField ...
The protected keyword marks field, methods properties and nested classes for use inside the same class and derived classes only: public class Foo() { protected void SomeFooMethod() { //do something } protected class Thing { private string blah; ...
The protected internal keyword marks field, methods, properties and nested classes for use inside the same assembly or derived classes in another assembly: Assembly 1 public class Foo { public string MyPublicProperty { get; set; } protected internal string MyProtectedInternalPropert...
Here are all access modifiers in venn diagrams, from more limiting to more accessible: Access ModifierDiagramprivateinternalprotectedprotected internalpublic Below you could find more information.

Page 1 of 1