private static TValue[] GetAttributeValues <TAttribute, TValue>([NotNull] this Enum value, Func <TAttribute, TValue> Selector) where TAttribute : Attribute { var attributes = value.GetValueAttribute <TAttribute>(); if (attributes is null || attributes.Length == 0) { return(Array.Empty <TValue>()); } var result = new TValue[attributes.Length]; for (var i = 0; i < result.Length; i++) { result[i] = Selector(attributes[i]); } return(result); }