Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

Knowledge base — C#

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 443

C#

!: practical reference

!: practical reference: Postfix ! suppresses a nullable-analysis warning without changing the runtime value.

Basic · C# operator reference; verified against C# 14
C#

..: practical reference

..: practical reference: .. creates a Range from optional Index bounds for slicing a supported type.

Basic · C# operator reference; verified against C# 14
C#

%: practical reference

%: practical reference: % returns the remainder after division; for signed values its sign follows the left operand.

Basic · C# operator reference; verified against C# 14
C#

%=: practical reference

%=: practical reference: %= computes a remainder and assigns it to the left operand.

Basic · C# operator reference; verified against C# 14
C#

>>: practical reference

>>: practical reference: >> shifts bits right; for signed operands it performs an arithmetic shift that propagates the sign bit.

Basic · C# operator reference; verified against C# 14
C#

>>=: practical reference

>>=: practical reference: >>= shifts right and assigns the result to the left location.

Basic · C# operator reference; verified against C# 14
C#

sizeof: practical reference

sizeof: practical reference: sizeof returns a type's size in bytes; in safe context it is permitted only for a built-in unmanaged type with platform-independent size or an enum.

Basic · C# operator reference; verified against C# 14
C#

-: practical reference

-: practical reference: - subtracts numbers, negates a unary operand, or computes differences for supported time types.

Basic · C# operator reference; verified against C# 14
C#

-=: practical reference

-=: practical reference: -= subtracts and assigns; for an event it unsubscribes a delegate.

Basic · C# operator reference; verified against C# 14
C#

typeof: practical reference

typeof: practical reference: typeof returns a Type object for a compile-time-known type without constructing an instance.

Basic · C# operator reference; verified against C# 14
C#

Unary plus (+x)

The +x operator returns its operand's numeric value without changing its sign. It neither increments a variable nor computes an absolute value. For small integral types, the result has type int.

Basic · .NET 10; repository net10.0 and LangVersion=preview; feature versions require per-entry verification
C#

>>>: practical reference

>>>: practical reference: >>> shifts right logically and always fills with zeros.

Basic · C# operator reference; verified against C# 14
C#

>>>=: practical reference

>>>=: practical reference: >>>= performs a logical right shift and assigns the result.

Basic · C# operator reference; verified against C# 14
C#

Nullable reference types and the #nullable context

The string and string? annotations express intent about null, while compiler flow analysis warns about unsafe use. The #nullable context controls annotations and warnings independently; it does not add runtime checks.

Intermediate · .NET 10; repository net10.0 and LangVersion=preview; feature versions require per-entry verification
C#

String interpolation

String interpolation inserts expression results directly into text using $"..." syntax. It supports value formatting, alignment, and literal braces; choose a culture explicitly when numeric formatting must be predictable.

Basic · .NET 10; repository net10.0 and LangVersion=preview; feature versions require per-entry verification
C#

bool: practical reference

bool: practical reference: bool is the System.Boolean alias with true and false values.

Basic · C# built-in type reference; .NET 10 runtime
C#

byte: practical reference

byte: practical reference: byte is an 8-bit unsigned integer ranging from 0 through 255.

Basic · C# built-in type reference; .NET 10 runtime
C#

char: practical reference

char: practical reference: char is a 16-bit UTF-16 code unit, not a complete Unicode character.

Basic · C# built-in type reference; .NET 10 runtime
C#

decimal: practical reference

decimal: practical reference: decimal is a 128-bit base-10 numeric type with high decimal precision.

Basic · C# built-in type reference; .NET 10 runtime
C#

double: practical reference

double: practical reference: double is a 64-bit IEEE 754 binary floating-point type.

Basic · C# built-in type reference; .NET 10 runtime
C#

dynamic — binding operations at runtime

The dynamic type defers operation binding until runtime. It simplifies interaction with dynamic APIs, but missing members or incompatible arguments can cause RuntimeBinderException instead of a compilation error.

Intermediate · .NET 10; repository net10.0 and LangVersion=preview; feature versions require per-entry verification
C#

float: practical reference

float: practical reference: float is a 32-bit IEEE 754 binary floating-point type with about seven decimal digits of precision.

Basic · C# built-in type reference; .NET 10 runtime
C#

int: practical reference

int: practical reference: int is the alias for the 32-bit signed System.Int32.

Basic · C# built-in type reference; .NET 10 runtime
C#

long: practical reference

long: practical reference: long is the 64-bit signed System.Int64 type.

Basic · C# built-in type reference; .NET 10 runtime