Wednesday, August 6, 2008

Quick Note

If you are doing a string split in C#, but are only using one character, you don't have to create a new char array to hold the one char, use this:

string str = "omfg|this is cool";
string[] arr = str.Split("|".ToCharArray());

w00t!

No comments:

Post a Comment