Double question mark operator in C#…

12 09 2010

Here is just a very quick overview of the double question mark operator (or ??) in C#. More information can be found here.

This operator simply means that if anything to the left is NOT NULL – use it, else move to the next untill you find a vaule that is not null. I.E.

int? k = null;
int? j = null;
int? s = 7;

return (k ?? j ?? s);

Simple as that!
Happy coding!

———
aQuila22

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: