static void Main() { ExtentionMethods Ex = new ExtentionMethods(); Ex.Test1(); Ex.Test2(); Ex.Test3(); Ex.Test4("Name"); Console.ReadKey(); }
static void Main() { ExtentionMethods Ex = new ExtentionMethods(); Ex.Test1(); Ex.Test2(); Ex.Test3(); Ex.Test4("Navjyot"); /*as int is struct can check with f12*/ int i = 5; //i.factorial() //as no factorial Methos we can add long result = i.Factorial(); // Now we have extention method for stuct int32 /*string is sealed class*/ string str = "oLd StRinG iS DirTy"; Console.WriteLine(str.ToProperCase()); Console.WriteLine(i + "!=" + result); Console.ReadKey(); }