Query to remove leading and trailing spaces from an array of strings

How do i remove the leading and trailing spaces out from the array of strings.
Only spaces at the starting and ending should be removed like “Trim” Function.

Can i get a linq query please for this

arrCleansed = yourArrVar.Select(Function (x) x.Trim()).toArray

Hi @JITU99

Try this-

string array = { " Apple", "Banana ", " Cherry ", " Date " };

var trimmedArray = array.Select(s => s.Trim()).ToArray();