diff --git a/Core/InteropServices/CorrespondingTypeAttribute.cs b/Core/InteropServices/CorrespondingTypeAttribute.cs
index 88426d65..ebd498b1 100644
--- a/Core/InteropServices/CorrespondingTypeAttribute.cs
+++ b/Core/InteropServices/CorrespondingTypeAttribute.cs
@@ -67,7 +67,7 @@ namespace Vanara.InteropServices
/// The enumeration type.
/// The type supplied by the user to validate.
/// true if this instance can get the specified type; otherwise, false.
- public static bool CanGet(TEnum value, Type typeRef) where TEnum : System.Enum => GetAttrForEnum(value).Any(a => a.Action.IsFlagSet(CorrespondingAction.Get) && a.TypeRef == typeRef);
+ public static bool CanGet(TEnum value, Type typeRef) where TEnum : System.Enum => GetAttrForEnum(value, CorrespondingAction.Get).Any(a => a.TypeRef == typeRef);
/// Determines whether this type can get the specified reference type.
/// The class type.
@@ -140,18 +140,12 @@ namespace Vanara.InteropServices
/// The enum value.
/// The action to filter for.
/// An enumeration of all associated CorrespondingTypeAttribute instances.
- protected static IEnumerable GetAttrForEnum(TEnum value, CorrespondingAction action) where TEnum : System.Enum =>
- GetAttrForEnum(value).Where(a => a.Action.HasFlag(action));
-
- /// Gets the CorrespondingTypeAttribute instances associated with an enum value.
- /// The enum value.
- /// An enumeration of all associated CorrespondingTypeAttribute instances.
- protected static IEnumerable GetAttrForEnum(TEnum value) where TEnum : System.Enum
+ protected static IEnumerable GetAttrForEnum(TEnum value, CorrespondingAction action = (CorrespondingAction)0xf) where TEnum : System.Enum
{
var valueType = value.GetType();
- var attr = valueType.GetField(value.ToString()).GetCustomAttributes();
- if (!attr.Any()) return new CorrespondingTypeAttribute[0];
+ var attr = valueType.GetField(value.ToString()).GetCustomAttributes(false, a => a.Action.HasFlag(action));
if (attr.Any(a => a.Action == CorrespondingAction.Exception)) throw new Exception();
+ //if (!attr.Any()) return new CorrespondingTypeAttribute[0];
return attr;
}