System.Waf.Foundation.DataErrorInfoSupport.this C# (CSharp) Метод

this() публичный Метод

Gets the error message for the property with the given name.
public this ( string memberName ) : string
memberName string The name of the property whose error message to get.
Результат string
        public string this[string memberName]
        {
            get
            {
                List<ValidationResult> validationResults = new List<ValidationResult>();

                if (string.IsNullOrEmpty(memberName))
                {
                    Validator.TryValidateObject(instance, new ValidationContext(instance, null, null), validationResults, true);
                }
                else
                {
                    PropertyDescriptor property = TypeDescriptor.GetProperties(instance)[memberName];
                    if (property == null)
                    {
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
                            "The specified member {0} was not found on the instance {1}", memberName, instance.GetType()));
                    }
                    Validator.TryValidateProperty(property.GetValue(instance),
                        new ValidationContext(instance, null, null) { MemberName = memberName }, validationResults);
                }

                return string.Join(Environment.NewLine, validationResults.Select(x => x.ErrorMessage));
            }
        }
    }
DataErrorInfoSupport