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#

pattern matching: practical reference

pattern matching: practical reference: C# patterns test type, value, and structure and can bind variables.

Intermediate · C# language and .NET 10 reference runtime
C#

performance and complexity: practical reference

performance and complexity: practical reference: Performance covers time, allocations, I/O, concurrency, and data characteristics.

Intermediate · C# language and .NET 10 reference runtime
C#

program entry point: practical reference

program entry point: practical reference: The entry point starts the process, receives arguments, and establishes the exit code.

Intermediate · C# language and .NET 10 reference runtime
C#

records and equality: practical reference

records and equality: practical reference: A record provides value semantics and with support; only a positional record synthesizes Deconstruct automatically.

Intermediate · C# language and .NET 10 reference runtime
C#

records and aggregates: practical reference

records and aggregates: practical reference: Aggregates group components into one value; tuples and positional records support deconstruction, while a non-positional record does not synthesize Deconstruct automatically.

Intermediate · C# language and .NET 10 reference runtime
C#

recursion: practical reference

recursion: practical reference: Recursion solves a problem by calling itself on a smaller case and defining a terminating base case.

Intermediate · C# language and .NET 10 reference runtime
C#

reductions and statistics: practical reference

reductions and statistics: practical reference: A reduction folds a sequence into a statistic such as sum, mean, minimum, or histogram.

Intermediate · C# language and .NET 10 reference runtime
C#

Resource disposal

Resource disposal is controlled cleanup when a resource is no longer needed. Synchronous `using` can call `IDisposable.Dispose` or a `Dispose` method that matches the disposal pattern on a `ref struct`, even if the type does not implement `IDisposable`. For asynchronous cleanup through `IAsyncDisposable.DisposeAsync`, use `await using`. Both constructs arrange cleanup when control leaves the scope, including because of an exception. Disposal is distinct from garbage collection reclaiming memory.

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

scope and lifetime: practical reference

scope and lifetime: practical reference: Scope determines name visibility, while lifetime determines how long a value or resource is valid.

Intermediate · C# language and .NET 10 reference runtime
C#

security boundaries: practical reference

security boundaries: practical reference: Security requires boundary validation, least privilege, and context-sensitive data encoding.

Intermediate · C# language and .NET 10 reference runtime
C#

sorting and comparison: practical reference

sorting and comparison: practical reference: Sorting orders elements according to a consistent comparer and chosen stability.

Intermediate · C# language and .NET 10 reference runtime
C#

Span and Memory: buffer views without copying

Span<T> and Memory<T> describe regions of existing buffers without copying their elements. Learn their lifetime restrictions, read-only variants, and text processing with AsSpan, IndexOf, SequenceEqual, and TryParse.

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

strings and text: practical reference

strings and text: practical reference: .NET strings are immutable sequences of UTF-16 code units.

Intermediate · C# language and .NET 10 reference runtime
C#

testing and assertions: practical reference

testing and assertions: practical reference: A test verifies an observable contract in a controlled arrange-act-assert setup.

Intermediate · C# language and .NET 10 reference runtime
C#

dates and time: practical reference

dates and time: practical reference: Time includes an instant, local date, zone, offset, and duration as distinct concepts.

Intermediate · C# language and .NET 10 reference runtime
C#

Type conversions

Conversions let you use an expression as a value of another type. Learn about implicit conversions, explicit casts, boxing, and unboxing. The C# specification requires an exact type match when unboxing to a non-nullable value type, but the .NET runtime also lets you unbox an enum as its underlying integral type. Under the specification, a nullable target accepts `null` or a boxed value of its underlying type.

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

type system: practical reference

type system: practical reference: The type system defines values, conversions, generic constraints, nullability, and dispatch.

Intermediate · C# language and .NET 10 reference runtime
C#

variables: practical reference

variables: practical reference: A variable has a type and scope, requires definite assignment, and stores a value or reference.

Intermediate · C# language and .NET 10 reference runtime
C#

Console.WriteLine: practical reference

Console.WriteLine: practical reference: Console.WriteLine writes a formatted representation to the current standard output and appends TextWriter.NewLine.

Basic · .NET API; verified on .NET 10.0.14
C#

Array.IndexOf: Find an allowed status

Use the static `Array.IndexOf` method to find the first occurrence of a status in an array and check whether that status is allowed.

Basic · C# 12 and .NET 8; later runtimes may add compatible features
C#

BoundedChannelOptions and BoundedChannelFullMode.Wait

Set a channel's buffer limit and see why, when it fills up, `TryWrite` returns `false` immediately but `WriteAsync` waits asynchronously for room.

Advanced · C# 12 and .NET 8; later runtimes may add compatible features
C#

Boxing and unboxing values in C#

Learn when C# copies a value into an object, why the boxed type must match when unboxing, and which exception each kind of failure produces.

Intermediate · C# 12 and .NET 8; later runtimes may add compatible features