Is this a bug in string.TrimEnd?

c#, string

Solution

the documentation says "If trimChars is null (Nothing in Visual Basic) or an empty array, white-space characters are removed instead. " So no, not a bug.

Problem

``` "\u4000\f".TrimEnd(new char[0]) ``` is equal to `"\u4000"`. I am passing an empty array, so according to the MSDN documentation nothing should be removed and `"\u4000\f"` should be returned. Is there a reason for this behaviour? EDIT: Clarified expected behaviour EDIT: Apparently, this changed in 3.5, I was looking at the 2.0 documentation page.

Original source