String.Split() Kwik-e
While I was cleaning up some legacy code I found an overly complex usage of String.Split() in several places:
1 | var sentence = "Hello World!"; |
If you take a look at the available overloads on Split() you may miss the params keyword. In fact it isn’t even visible on the overview page:
But if you take a closer look on Split(char[]) you will see this:
The params keyword tells you that the method accepts any number of arguments of type char. So you could also provide only one, which will simplify the given sample to:
1 | var sentence = "Hello World!"; |