Possible Duplicate:
C#: Convert string to model
Let's say I need to take a string and turn it into an array. This string has a single universal character to denote a new element. For example, I want to turn this string:
var s = "first|second|third";
Into this array:
var segments = new[]
{
"first",
"second",
"third"
};
Is there an easier way to do it than this:
var segments = s.Split(new char[] { '|' });
I feel uncomfortable writing (new char[] { '|' }
. I feel like there's probably this method, but I can't find its signature:
var segments = s.Split('|');