Null Coalescing Operator : Nullable « Data Type « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Data Type » Nullable 
2.54.7.Null Coalescing Operator
using System;

class MainClass
{
   static void Main()
   {
      int? nullableInteger = null;
      Console.WriteLine("nullableInteger: {0}", nullableInteger ?? -1);

      nullableInteger = 10;
      Console.WriteLine("nullableInteger: {0}", nullableInteger ?? -1);
   }
}
nullableInteger: -1
nullableInteger: 10
2.54.Nullable
2.54.1.null unification
2.54.2.Nullable long
2.54.3.Nullable Struct
2.54.4.Nullable Types Access: Explicitly use properties
2.54.5.Nullable Types Access: shortcut syntax
2.54.6.Nullable Types Assignment
2.54.7.Null Coalescing Operator
2.54.8.A nullable type
2.54.9.Use nullable objects in expressions: result contains null, because one operand is null
2.54.10.Assign value to nullable int
2.54.11.Using ??
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.