Nullables : ,100,,3.1457 A Nullable Boolean Value :
Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
Nullable Data Types in C#
Nullable Data Types in C#
This is a C# Program to illustrate nullable data types.
This C# Program Ilustrates Nullable Data Types.
Here C# provides a special data types, the nullable types, to which you can assign normal range of values as well as null values.
Here is source code of the C# Program to Ilustrate Nullable Data Types. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Ilustrate Nullable Data Types */ using System; namespace Application { class Nullables { static void Main(string[] args) { int? num1 = null; int? num2 = 100; double? num3 = new double?(); double? num4 = 3.14157; bool? boolval = new bool?(); Console.WriteLine("Nullables : {0}, {1}, {2}, {3}", num1, num2, num3, num4); Console.WriteLine("A Nullable boolean value: {0}", boolval); Console.ReadLine(); } } }
This C# program is used to illustrate nullable data types. Here C# provides a special data types, the nullable types, to assign normal range of values as well as null values. The null coalescing operator is used with the nullable value types and reference types.
It is used for converting an operand to the type of another nullable (or not) value type operand, where an implicit conversion is possible. If the value of the first operand is null, then the operator returns the value of the second operand, otherwise it returns the value of the first operand. Print the nullable data types.