how to get UDA only for methods
test
test at gmail.com
Wed Oct 17 02:54:26 UTC 2018
I need get the Route UDA only for method without (static methods,
property, constructor, destructor), dont know how to do it.
Route[] getRoutes(T)(){
Route[] routes;
foreach(int i, m; __traits(allMembers, T) ){
pragma(msg, m.stringof);
static foreach(int j, r; getUDAs!(m, Route) ) {
routes ~= r;
}
}
return routes;
}
struct App {
@Route("/index")
void home(){
}
@Route("/blog")
void blog(){
}
}
More information about the Digitalmars-d-learn
mailing list