mirror of https://github.com/dahall/Vanara.git
Fixed bug with CorrespondingTypeAttribute.GetAttrForEnum with default action
parent
857e7c4703
commit
30167bc6ca
|
@ -183,7 +183,7 @@ namespace Vanara.InteropServices
|
|||
protected static IEnumerable<CorrespondingTypeAttribute> GetAttrForEnum<TEnum>(TEnum value, CorrespondingAction action = (CorrespondingAction)0xf) where TEnum : System.Enum
|
||||
{
|
||||
var valueType = value.GetType();
|
||||
var attr = valueType.GetField(value.ToString()).GetCustomAttributes<CorrespondingTypeAttribute>(false, a => a.Action.HasFlag(action));
|
||||
var attr = valueType.GetField(value.ToString()).GetCustomAttributes<CorrespondingTypeAttribute>(false, a => (a.Action & action) > 0);
|
||||
if (attr.Any(a => a.Action == CorrespondingAction.Exception)) throw new Exception();
|
||||
//if (!attr.Any()) return new CorrespondingTypeAttribute[0];
|
||||
return attr;
|
||||
|
|
Loading…
Reference in New Issue