CSharp - Write program to remove the characters such as d, dot(.), blanks, and tab spaces at the end from the string

Requirements

How we can remove the characters such as d, dot(.), blanks, and tab spaces at the end from the string.

Hint

Use the overloaded TrimEnd() method and pass in the character we would like to remove.

Demo

using System;

public class MainClass
{
    public static void Main(String[] argv)
    {//from w w  w  .jav  a 2s  .  co m
        char[] trimCharacters = { ' ', '\t', '.', 'd' };
        string blankSpaceAtEnd = "This line contains blank and tab spaces at End.";
        Console.WriteLine(blankSpaceAtEnd.TrimEnd(trimCharacters));

    }
}

Result