Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

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

Entries: 5788

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
C#

GetValueOrDefault on IReadOnlyDictionary

Look up a dictionary value with a fallback and know when to distinguish a missing key from a stored `null`.

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

`Environment.Exit(0)` after printing a report

End the entire process after printing a report and signal success with exit code `0`. Learn when returning from `Main` is the better choice.

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

Func delegates and invariant report formatting

Use a bool-returning delegate to filter items, a decimal-returning delegate to select amounts, and invariant formatting to render the total.

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