Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

null: practical reference

null: practical reference: null denotes the absence of a reference or of a nullable value.

Version: C# language; verified against C# 14 reference

Syntax

null /* grammar-specific form */

null denotes the absence of a reference or of a nullable value.

Use it as an explicitly modeled optional case only when the domain permits it.

NullReferenceException usually signals missing validation or a broken invariant.

Nullable annotations do not change runtime; pattern is null bypasses overloaded ==.

The complete program actually uses null; its exact expected stdout is True.

Examples

using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;

string? value = null; Console.WriteLine(value is null);

Result

True

The complete program actually uses `null`; its exact expected stdout is `True`.

Sources