C#, you can use the TrimEnd() method to remove trailing whitespace characters from the end of a string.
the TrimEnd() method is used to remove the trailing whitespace characters from the end of the string str, and returns the trimmed string as trimmedStr. The resulting output is the trimmed string, without any trailing whitespace characters.
use the TrimEnd() method with an argument to remove specific characters from the end of a string.
the TrimEnd() method is used with an array of characters to remove the '=' and '!' characters from the end of the string str. The resulting output is the trimmed string, without any '=' or '!' characters at the end.