No, this is not a bug. As far as the Split method is concerned, you have 1 zero length string in foo. If you made foo = "," you would have 2 zero length strings. You can tell the Split method to remove empty elements, it's the second parameter to the method (System.StringSplitOptions
). This should then return a zero element array for an empty string.