MidpointRounding — choosing a rounding rule
MidpointRounding specifies a rounding rule. ToEven and AwayFromZero both choose the nearest result, but resolve values exactly halfway between two possible results differently.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
MidpointRounding specifies a rounding rule. ToEven and AwayFromZero both choose the nearest result, but resolve values exactly halfway between two possible results differently.
System.Threading.Monitor combines mutual exclusion with waiting for shared state to change. Enter and Exit manage the lock, TryEnter can bound acquisition waiting, and Wait, Pulse, and PulseAll coordinate threads.
System.Collections.IEnumerable exposes iteration without specifying an element type through a generic parameter. Its GetEnumerator() method returns IEnumerator, and foreach reads elements through this contract.
System.Collections.IEnumerator describes a cursor for sequentially reading elements. It exposes MoveNext(), an object-valued Current, and Reset(); it is not a collection and does not guarantee IDisposable support.
NotNullWhenAttribute describes the relationship between a method's bool result and an argument's null-state. It lets nullable analysis recognize the safe branch after a checking method or a Try*-style method, without using the ! operator.
System.NullReferenceException signals an attempt to dereference null, such as reading a property on an object that does not exist. Learn the cause, the role of nullable analysis, and the difference between !, ?., and ??.
NumberFormatInfo supplies rules for formatting and parsing numbers, including separators and currency symbols. Learn its core methods, the distinction between current and invariant settings, and how to create a custom configuration safely.
OperationCanceledException signals that an operation was canceled. Learn how it works with CancellationToken, what ThrowIfCancellationRequested() does, and how requesting cancellation differs from acknowledging it.
BindingFlags controls which type members reflection searches for. Combine visibility and member-kind flags with |, and use DeclaredOnly to exclude inherited members.
RegionInfo in System.Globalization exposes information about a country or region. Its RegionInfo.ISOCurrencySymbol property returns a three-letter ISO 4217 currency code, such as USD, rather than a currency sign such as $.
String.Join combines elements into one string, inserting a separator between them. Null values are not skipped.
System.Action represents a parameterless operation that returns void. The Action<T> variant accepts one argument. Both types let you store and pass behavior, such as a method that prints a message, without declaring a custom delegate type.
System.Activator: practical reference: Activator.CreateInstance creates an instance of a type selected at run time through an available constructor.
System.ArgumentException: practical reference: ArgumentException denotes a non-null argument that violates the contract and can retain its ParamName.
System.ArgumentNullException: practical reference: ArgumentNullException specializes the error for a required argument that is null; ThrowIfNull retains the expression name.
System.Attribute: practical reference: Attribute is the base for metadata attached to types and members and read through reflection.
System.Buffers.ArrayPool: practical reference: ArrayPool<T> rents an array whose length is at least the requested size and requires Return.
System.Buffers.IBufferWriter: practical reference: IBufferWriter<T> exposes writable storage through GetSpan or GetMemory, while Advance commits the exact number of elements written.
System.Buffers.MemoryPool: practical reference: MemoryPool<T> rents an IMemoryOwner<T> whose Memory<T> remains owned until Dispose returns the resource.
System.Collections.Concurrent.ConcurrentBag: practical reference: ConcurrentBag<T> is a thread-safe unordered collection optimized for threads that add and take their own local items.
System.Collections.Concurrent.ConcurrentDictionary: practical reference: ConcurrentDictionary<TKey,TValue> supports concurrent reads and atomic operations on individual key-value entries.
System.Collections.Concurrent.ConcurrentQueue: practical reference: ConcurrentQueue<T> provides thread-safe first-in, first-out behavior through Enqueue and TryDequeue.
System.Collections.Frozen.FrozenDictionary: practical reference: FrozenDictionary<TKey,TValue> is an immutable lookup index prepared once for fast and frequent key reads.
System.Collections.Frozen.FrozenSet: practical reference: FrozenSet<T> is an immutable set optimized for repeated Contains checks after construction is complete.