You can use a string mixin:

class Foo
{
    int a;
    @(3) private int b;
}

void main()
{
    writeln(mixin("__traits(getAttributes, " ~ Foo.tupleof[1].stringof ~ ")")); // -> 3
}

 

Hmm....

This works only when main is in the same file (and therefor module) as Foo.

Regards
- Puneet