So we can do something like this:
public static int[] ToIntArray(this string value, char separator)
{
return Array.ConvertAll(value.Split(separator), s=>int.Parse(s));
}
int[] result = "1,2,3".ToIntArray(',');
A simple repository for code snippets
So we can do something like this:
public static int[] ToIntArray(this string value, char separator)
{
return Array.ConvertAll(value.Split(separator), s=>int.Parse(s));
}
int[] result = "1,2,3".ToIntArray(',');
No comments:
Post a Comment