Click here to Skip to main content
15,896,201 members
Articles / Programming Languages / C#

Converting a nullable object to an integer

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
19 Mar 2011CPOL 20.2K   2  

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
19 Mar 2011AspDotNetDev
Here is a slightly shorter version of your first conversion:object someValue = 1;int result = someValue as int? ?? -1;
Please Sign up or sign in to vote.
16 May 2011Eduard Keilholz 2 alternatives  
Type conversion

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Repstor Ltd
United Kingdom United Kingdom
I am a Product Architect at Repstor.

Repstor custodian and Repstor Provisioning Engine provide case management and provisioning for SharePoint.

Repstor affinity provides uninterrupted access to content systems, like SharePoint through the familiar interface of Microsoft Outlook.

Comments and Discussions