public static System.Reflection.PropertyInfo FindProperty(this Employee employee, string name) { if (employee == null) { throw new ArgumentNullException(nameof(employee)); } foreach (var item in employee.GetType().GetProperties()) { DescriptionAttribute description = (DescriptionAttribute)item.GetCustomAttributes(typeof(DescriptionAttribute), false)[0]; if (description.Description == name) { return(item); } } throw new KeyNotFoundException($"Поле '{name}' не найдено в описании объекта '{nameof(employee)}'"); }