1
2 public static TAttribute[] GetCustomAttributes<TAttribute>(this PropertyInfo @this, bool inherit = true, TAttribute theDefault = null) where TAttribute : Attribute
3 {
4 if (@this == null) return null;
5
6 var result = @this.GetCustomAttributes(typeof(TAttribute), inherit);
7
8 if (result.Length == 0 && theDefault != null) return new[] { theDefault };
9
10 return (TAttribute[])result;
11 }