C# Null | C# Nullable - c# - c# tutorial - c# net
What is Nullable type in C# ?
- A value type variable cannot be null.
- A nullable type can represent the correct range of values for its underlying value type, plus an additional null value.
- Nullable types can represent all the values of an underlying type, and an additional null value.
Nullable in csharp
C# Sample Code - C# Examples:
- Integer type can also be assigned the value a null : int? a = null;
- Integer type can also be b assigned the value 10 null: int? b = 10;
- It is used to store large and small values. It is used to new double type that assigned to the c variable
- Double type can also be d assigned the value double? d = 2.2254; null: double? d = 2.2254;
- In Console.WriteLine, the Main method specifies its behavior with the statement "wikitechy says the Nullables values are:". to be displayed on the screen.
Sample C# examples - Output :
- Here in this output we display the "wikitechy says the Nullables values are: , 10, , 2.2254" which specifies to integer variable a "null", integer b variable value as 10, new double value and double variable d value as 2.2254.