Operator overloading, structs

Sam samhudotsamhu at gmail.com
Mon Jun 22 21:25:58 PDT 2009


bearophile Wrote:

> 
> There's a certain number of C# features I'd like to see in D (like nullable types that act as nan of floating point numbers, etc).
> 
> Bye,
> bearophile
C#3 also provides the null coalescring operator (??):

Code snippet 1 in C#1:
Address address =user.getContactAddress;
if(address==null)
{
address=order.getShippingAddress;
if(address==null)
{
address=user.getBillingAddress;
}
}

Code snippet 2 in C#3 with ?? operator:

Address address=user.getContactAddress??
                         user.getShippingAddress??
                         user.getBillingAddress;


Regards,
Sam



More information about the Digitalmars-d mailing list