[nem-en] Operator ??
Ivan A Eryshov
ivan.eryshov at gmail.com
Mon Sep 18 08:38:26 CEST 2006
As I understand, operator ?? is absent at all. But you can easily add it
using the macro:
macro @?? (expr1, expr2)
{
<[ if ($expr1 == null) $expr2; else $expr1; ]>
}
and then use them in such way:
WriteLine("123" ?? "321");
WriteLine(null ?? "321");
Actualy, this macro will not work with nullable types completely, but you
can modify it for working with nullable types too ;)
On 9/18/06, Igor Tkachev <it at rsdn.ru> wrote:
>
> Hi All,
>
> C# has the ?? operator which is the shortest form of the short if:
>
> a = b == null ? c : b;
>
> Instead of this we can write the following:
>
> a = b ?? c;
>
> It came with nullable types, but also works fine with reference types.
>
> Can we get something like that?
>
> --
> Best regards,
> Igor mailto:it at rsdn.ru
>
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20060918/02fbfbd6/attachment.html
More information about the devel-en
mailing list