This culd be usefui, if a string is null or it has spaces at the end;
Example:
string Test = "1, 2, 3, 4, "; Test = Test.TrimEnd(','); //Result: "1, 2, 3, 4, "; Test = (Test ?? "").Trim().TrimEnd(','); //Result: "1, 2, 3, 4";