CKTIS / C#
is: practical reference
is: practical reference: is tests a type or pattern and can bind a narrowed variable; a simple type test returns false, rather than throwing InvalidCastException, for null or a type mismatch.
Version: C# language; verified against C# 14 reference
Syntax
left is rightis tests a type or pattern and can bind a narrowed variable; a simple type test returns false, rather than throwing InvalidCastException, for null or a type mismatch.
Use it for safe type and null tests and for explicit pattern matching.
A simple type test does not invoke user-defined conversions, but property, positional, Deconstruct-based, and ITuple patterns can execute user code that throws.
null does not match a type pattern, while logical patterns have their own precedence.
The complete program actually uses is; its exact expected stdout is True.
Examples
using System;
using System.Linq;
using System.Threading.Tasks;
object value = 12; Console.WriteLine(value is int number && number > 10);
Result
True
The complete program actually uses `is`; its exact expected stdout is `True`.