introspection woes...
Lloyd Dupont
ld-REMOVE at galador.net
Mon Jun 13 00:26:37 PDT 2011
Trying to play with introspection.
trying o, for a given object, to check its property by name.
Experimenting with the function below.
1. it doesn't compile! mi.name() seems to be a problem?
2. match is always null! even though I pass the name of an existing property
and / or field!
===============
Object getelement(Object o, string aname)
{
if (!o)
return null;
auto ci = o.classinfo;
writefln("class: %s", ci.name);
auto match = ci.getMembers(aname);
foreach(mi ; ci.getMembers(null))
{
writefln("%s . %s", ci.name, mi.name());
}
//writefln("match: %s", match);
return o;
}
==============
More information about the Digitalmars-d-learn
mailing list