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 }