| Start |
|---|
| Initialising a nullable For Or: Or: For non-null values: Or: |
Check if a Nullable has a value Which is the same as: |
| Get the value of a nullable type Given following nullable In case default value is needed, you can assign one using null coalescing operator (opens new window), The following usage is always unsafe. If |
| Getting a default value from a nullable The Output: |
Check if a generic type parameter is a nullable type |
Default value of nullable types is null Output: null |
| Effective usage of underlying Nullable Any nullable type is a generic type. And any nullable type is a value type. There are some tricks which allow to effectively use the result of the Nullable.GetUnderlyingType (opens new window) method when creating code related to reflection (opens new window)/code-generation purposes: The usage: Output: PS. The Syntax
RemarksNullable types can represent all the values of an underlying type as well as The syntax Nullable values are When a nullable object boxing, the null value is converted to The second rule leads to correct, but paradoxical code: In short form: |
Read Article
https://develop.horje.com/learn/1434/reference