Category: C#

Private Access Modifier in C# with Example

Private access modifier in C# is only used when you want to use some type member within the containing type only and want to restrict it from accessing outside of the containing type.  All type members are by default Private, so it is not necessary to use Private keyword in front of them.  But it’s

Public Access Modifier in C# with Example

Public access modifier is one of the 5 access modifiers in C#.  Public access modifier is only used when you want to make any type member to be globally accessible within the containing type as well as outside of the containing type.  An example of Public access modifier in C# is given below.   using

Access Modifiers in C#

In C#, access modifiers play a major role. They basically decide bounderies of your type and type members. Based on the access modifier, you can restrict access or allow access to any type or type member. There are 5 types of access modifiers. Public Private Protected Internal Protected Internal Type members like methods, fields, properties

Exception Handling in C# with Example

Exceptions are unexpected errors generated by the CLR.  It is very common that while executing your application you encounter some error and later you fix it by knowing the reason behind it.  There are bunch of predefined exceptions in the DotNet framework like FileNotFound, DivideByZero, FormatException etc.  However, name of these exceptions is pretty much