String.Empty versus "" – The real deal
This is one topic that keeps popping up every now and then. A lot of people seem to be curious about the performance implications of using one versus the other, and not unexpectedly, a lot of different answers come up. To settle it once for all, here’s a small program that uses both of them. namespace ConsoleApplication{ class Program { static void Main() { Method1(); Method2(); Console.ReadLine(); Method1(); Method2(); } [MethodImpl(MethodImplOptions.NoInlining)] static void Method1() { string s = “”; DoNothing(s); } [MethodImpl(MethodImplOptions.NoInlining)] static void Method2() { string s = string.Empty; DoNothing(s); } [MethodImpl(MethodImplOptions.NoInlining)] static void DoNothing(string s) { Console.WriteLine(s); } … Continue reading String.Empty versus "" – The real deal