Solved

int? ??

Posted on 2013-02-06
3
356 Views
Last Modified: 2013-02-06
Hi:

Can someone help me make sense of the following  c# code, please?

int myint = myvar as int? ?? 0;
0
Comment
Question by:sdc248
3 Comments
 
LVL 22

Accepted Solution

by:
p_davis earned 250 total points
ID: 38860312
int myint = myvar as int? ?? 0;

int? is a nullable variable the ?? checks for null and if it is the value returned is 0
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 250 total points
ID: 38860326
It means if myvar is null then it is converted to zero when assigned to myint
(if myvar is null then myint = 0)
0
 

Author Closing Comment

by:sdc248
ID: 38860352
Thanks, guys.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question