I’m getting inconsistent results with TrimEnd() under .NET 3.5. TrimEnd seems so simple to use, is there something I’m doing wrong here or is this a bug
Success case
var foundvalue = "hosted.local.chatter.com";
Console.WriteLine(foundvalue.TrimEnd(".chatter.com".ToCharArray()));
// Result is "hosted.local" which is expected.
Failure case
var foundvalue = "hosted.local.chattermailcom";
Console.WriteLine(foundvalue.TrimEnd(".chattermailcom".ToCharArray()));
// Result is "hosted" which is incorrect
Maybe you could write your own method for that: