How to Trim a String in C#/CSharp

How to Trim a String in C#/CSharp

To trim a string in C#/CSharp, we make use of Trim() method.  This will remove any extra space before and after the string.  Example is given.

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •