I've got a situation like the following:
enum Header
{
Sync,
[OldProtocol] Keepalive,
Ping,
[OldProtocol] Auth,
[OldProtocol] LoginData
//...
}
I need to obtain an array of elements on which the OldProtocolAttribute
is defined. I've noticed that the Attribute.IsDefined()
method and its overloads apparently don't support this kind of situation.
My question is:
- Is there a way to solve the problem without using in any part of the solution
typeof(Header).GetField()
? - If not, what's the most optimal way to solve it?