static void CanWriteCheck(Object obj) { Attribute checking = new AccountsAttribute(Accounts.Checking); Attribute validAccounts = Attribute.GetCustomAttribute(obj.GetType(), typeof(AccountsAttribute), false); if (validAccounts != null && checking.Match(validAccounts)) { Console.WriteLine($"{obj.GetType()} types can write checks."); } else { Console.WriteLine($"{obj.GetType()} types can NOT write checks."); } }