How to trim whitespaces from column names in datatable


I have a datatable which has leading and trailing whitespaces. I want to remove them but not the ones in the middle.
For eg: " Column 1 " to “Column 1”



try this
ListA=(From p in dt.columns.CastOf(System.Data.DataColumns)
Select Convert.ToString( p ).Trim).ToList

You will get the column names without spaces.