Recently working on an application based on a legacy database with a lot of char data types I was using automapper and needed to trim all non null strings for every model->viewModel mapping. I used the below code which trims ALL strings and also converts nulls to an empty string.
