Undefined values: Difference between revisions

Content added Content deleted
m (→‎{{header|C sharp|C#}}: Fixed Code and Lang blocks)
Line 7: Line 7:


This can't be used normally for value types (<code>int</code>, <code>double</code>, <code>DateTime</code>, etc.) since they are no ''references,'' so the following is a compiler error:
This can't be used normally for value types (<code>int</code>, <code>double</code>, <code>DateTime</code>, etc.) since they are no ''references,'' so the following is a compiler error:
<lang csharp>int i = null;</code>
<lang csharp>int i = null;</lang>
With .NET 2.0 there is an additional <code>Nullable<T></code> structure which enables those semantics for value types as well:
With .NET 2.0 there is an additional <code>Nullable<T></code> structure which enables those semantics for value types as well:
<lang csharp>int? answer = null;
<lang csharp>int? answer = null;