...e.g. String.Split(Delim As String).
+4
A:
Yes, it is odd, have cursed at it myself several times. Equally odd is that the Split() overloads that take a string were not available in .NET 1.x. Well, odder perhaps. Maybe some "not too many overloads!" paralysis here. The StringSplitOptions and Count arguments can generate a combinatorial number of them.
Fix it with an extension method:
public static class Extensions {
public static string[] Split(this string s, string separator) {
return s.Split(new string[] { separator }, StringSplitOptions.None);
}
}
And add the ones you need if you also want to cover StringSplitOptions and Count :)
Hans Passant
2010-07-10 15:48:18
Too many overloads sounds like a reasonable guess at a reason to me, thanks Hans - the extension method 'workaround' is a good one - at least 'til .Net 7.0 is released which supports 1,437 different overloads of String.Split.
Will A
2010-07-10 16:08:46