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

Base64 Encode & Decode Example in C#/CSharp

A simple Base64 Encode and Decode Example in C#/CSharp.   Base64 Encode Example in C# public static string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return System.Convert.ToBase64String(plainTextBytes); }     Base64 Decode Example in C# public static string Base64Decode(string base64EncodedData) { var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData); return System.Text.Encoding.UTF8.GetString(base64EncodedBytes); }  

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

As keyword in C# with Example

We have seen how to use is operator before type casting.  Another way to check whether type casting was successful or not, is as keyword.  If the type casting was successful, reference variable point to that object in memory.  If the type casting was failed, then reference variable contains a null value.  So before execution