private String validate(account_types accountType) { StringBuilder sb = new StringBuilder(); foreach (var prop in accountType.GetType().GetProperties()) { if (prop.PropertyType == typeof(string)) { prop.SetValue(accountType, ((string)prop.GetValue(accountType)).Trim()); } } if (accountType.description.Length == 0) { sb.Append("- El campo descripciĆ³n es obligatorio\n"); } return(sb.ToString()); }