[Mono-dev] gmcs and The Future
Avery Pennarun
apenwarr at gmail.com
Thu Feb 5 12:33:14 EST 2009
On Thu, Feb 5, 2009 at 12:19 PM, Jonathan Pryor <jonpryor at vt.edu> wrote:
> On Thu, 2009-02-05 at 12:10 -0500, Avery Pennarun wrote:
>> (The reason I use cpp, incidentally, is so I can implement C-style
>> assert() and check() macros that actually print the condition being
>> tested as part of the assertion message. There seems to be no other
>> way to do this in C#, which is too bad.)
>
> There is now. It's not the most performant technique around, but your
> Assert() or Check() methods could take an Expression<T>. The
> Expression<T> can then be converted into a string for diagnostic
> messages, and converted into a delegate for the actual condition check,
Hey, wow, I totally forgot about that. I'm going to have to learn
more about Expression<T> now. I guess I was planning to anyway... :)
Thanks!
Have fun,
Avery
More information about the Mono-devel-list
mailing list