This feels wrong:
private decimal ConvertStringToDecimal(string decimalString, decimal defaultReturnValue)
{
var returnDecimal = defaultReturnValue;
try
{
returnDecimal = decimal.Parse(decimalString.Trim());
}
catch (Exception)
{
// naughty
}
return returnDecimal;
}
but I think this is the only way to transform a string from a third party system to a decimal whilst returning a default. Does anyone have any suggestions on how to improve this?