The following are hidden or little-known useful features of C# -
The lambda expression in C# describes a model. It has the tag => in the expression context. This is called the go to operator and is used when declaring a lambda expression.
C# provides a special data type, the nullable type, to which you can assign a normal range of values as well as a null value. Following is the syntax -
<data_type> ? <variable_name> = null;
Null Coalescing Operator is used with nullable value types and reference types. It is used to convert one operand to the type of another nullable (or non-nullable) value type operand, where implicit conversion is possible.
The "as" keyword performs conversions between compatible types. It is similar to a cast operation and only performs reference conversions, nullable conversions, and boxing conversions. The as operator cannot perform other conversions, such as user-defined conversions; instead, cast expressions should be used to perform these conversions.
The above is the detailed content of What are the hidden features of C#?. For more information, please follow other related articles on the PHP Chinese website!