<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The problem is that to access a UDA attached to a field I need to pass a symbol to the __traits(getAttributes). With "tupleof" I can get the name, type and value of a field but I cannot get a symbol.<br>
<br>
__traits(getMember) can be used to get the symbol but that will only work for public fields.<br></blockquote><div><br></div><div>You can use a string mixin:</div><div><br></div><div>class Foo</div><div>{</div><div>    int a;</div>
<div>    @(3) private int b;</div><div>}</div><div><br></div><div>void main()</div><div>{</div><div>    writeln(mixin("__traits(getAttributes, " ~ Foo.tupleof[1].stringof ~ ")")); // -> 3</div><div>
}</div><div><br></div><div> </div></div>