CKTIS / C#
not: praktična referenca
not: praktična referenca: not zanika vzorec v is ali switch.
Različica: C# language; verified against C# 14 reference
Sintaksa
not /* grammar-specific form */not zanika vzorec v is ali switch.
Uporabite za jasen izključek tipa, null ali obsega.
Prednost z and in or lahko preseneti; uporabite oklepaje.
Deklaracija spremenljivke vzorca pod not je napaka prevajanja CS8780; ne gre le za njeno poznejšo dosegljivost ali definite assignment.
Celoten program dejansko uporabi not; natančno pričakovani stdout je True.
Primeri
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;
object? value = null; Console.WriteLine(value is not string);
Rezultat
True
Celoten program dejansko uporabi `not`; natančno pričakovani stdout je `True`.