You can read all the C# performance tips from the following links,
- C# Programming Performance Tips - Part One - String Split
- C# Programming Performance Tips - Part Two - String Equals
- C# Programming Performance Tips - Part Three - Adding Strings
- C# Programming Performance Tips - Part Four - List.Count() Vs List.Any()
- C# Programming Performance Tips - Part Five - List.Count() Vs List.Count
- C# Programming Performance Tips - Part Six - Array Length
C# has a total of 10 overload methods.

Most of the developers adopt the below approach.
- string str = "Akshay|Patel";
- Stopwatch s1 = new Stopwatch();
- s1.Start();
- string[] temp1 = str.Split('|');
- Console.WriteLine(s1.ElapsedTicks.ToString());
Let’s change the approach; i.e., rather than passing the character directly, let us create an array of characters and pass them as array elements.
- Stopwatch s2 = new Stopwatch();
- s2.Start();
- string[] temp = str.Split(new char[] {
- '|'
- });
- Console.WriteLine(s2.ElapsedTicks.ToString());
Run the application and compare the execution time.

The result suggests adopting the second approach to save the execution time.

Dinas RidasPosted Sep 8, 2025, 11:52 AM
Just swap s1 and s2 sections, and you will see, that 1st is 8 times faster than second
Hung VoPosted May 24, 2019, 8:37 PM
I think they are not too much difference, try this code static void Main(string[] args) { var rawValue = "hello,world"; Stopwatch s1 = Stopwatch.StartNew(); for (int i = 0; i < 1000000; i++) { rawValue.Split(','); } s1.Stop(); Console.WriteLine(s1.ElapsedTicks); Stopwatch s2 = Stopwatch.StartNew(); for (int i = 0; i < 1000000; i++) { rawValue.Split(new char[] { ',' }); } s2.Stop(); Console.WriteLine(s2.ElapsedTicks); Console.WriteLine("-------"); Console.ReadKey(); }
Zulqadar IdrishiPosted May 16, 2019, 4:05 AM
No I don't think so, I tested it. The only different is when you put second method to first It will take much time and The second method will take less time. If you think second approach is taking less time then execute only the second one and see the magic.
Rajesh PatelPosted May 16, 2019, 12:28 AM
Its clearly visible on attached image, when we use str.Split('|'), it call Split method with parameter [params], this results in an array allocation even if no parameter is passed in for the params parameter
Etienne YamsiPosted May 15, 2019, 10:14 AM
But why?? I don't understand. Can you explain what's happening in background ? ?