The new ?? and ??? operators

Arlen Albert Keshabyan arlen.albert at gmail.com
Mon Sep 24 05:15:49 PDT 2007


Rioshin anHarthen Wrote:

> "Arlen Albert Keshabyan" <arlen.albert at gmail.com> kirjoitti viestissä 
> news:fd7rir$2u8a$1 at digitalmars.com...
> > ?? operator should handle only object references, I think. Nothing more 
> > than that.
> 
> I can't begin to count how many times I've written code like
> 
>     long id = data.GetLong("ID") ?? 0;
> 
> or
> 
>     long? id = data.GetLong("ID");
> 
> and then later accessing the value with
> 
>     id ?? 0
> 
> at some other point when doing DB coding with C#.
> 
> The ?? operator, as well as the nullable ? types, are quite nice to have 
> when interfacing with the database. 
> 


Agreed partly.




More information about the Digitalmars-d mailing list