On 2009-08-03 11:03:54 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

Now that I think of it, even if properties don't readily return delegates, they are trivially easy to obtain:

class A
{
     ... define property foo with whatever syntax ...
}

unittest
{
     auto a = new A;
     auto getter = () { return a.foo; }
     auto setter = (int x) { a.foo = x; }
     setter(5);
     writeln(getter());
}

I actually compiled and ran that with foo defined as a regular field.

They're indeed very easy to obtain, and using this method improves compatibility with regular fields, so it's great.

That said, can you see the property through reflection?

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to