DateOnly & TimeOnly
.NET 6 introduced two long-awaited types - DateOnly and TimeOnly, which represent the date and time portions of DateTime, respectively.
Parallel.ForEachAsync
It can control the parallelism of multiple asynchronous tasks.
ArgumentNullException.ThrowIfNull()
A small improvement to ArgumentNullException, which doesn't need to check for null in each method before throwing an exception, now only needs to write a line, and response. EnsureSuccessStatusCode(); Similar.
PriorityQueue
The new data structure in .NET 6, PriorityQueue, has an associated priority for each element in the queue, which determines the order in which the element with a small number is prioritized.
RandomAccess
Provides an offset-based API for reading and writing files in a thread-safe manner.
PeriodicTimer
Recognize a completely asynchronous "PeriodicTimer", which is better suited for use in asynchronous scenarios, and it has a method called WaitForNextTickAsync.
Metrics API
.NET 6 implements the OpenTelemetry Metrics API specification, which has a built-in metrics API to create the following metrics through the Meter class
• Counter • Histogram • ObservableCounter • ObservableGauge
Here's how to use it:
Check if the element can be an empty reflection API
It provides emptiness information and context from reflection members:
• ParameterInfo parameter • FieldInfo field • PropertyInfo property • EventInfo events
ProcessId & ProcessPath
Get the process ID and path directly through the Environment.
Configuration Adds GetRequiredSection()
It's the same as DI's GetRequiredService(), if it's missing, it throws an exception.
CSPNG Password Secure Pseudo-Random Number Generator
You can easily generate random value sequences from the Password Secure Pseudorandom Number Generator (CSPNG).
It is useful in the following scenarios:
• Key generation • Random numbers • Salt in some signature schemes
Native Memory API
.NET 6 introduces a new API for allocating native memory, and NativeMemory has ways to allocate and free memory.
Power of 2
.NET 6 introduces new methods for handling powers of 2.
• 'IsPow2' determines whether the specified value is a power of 2. • 'RoundUpToPowerOf2' rounds the specified value to a power of 2.
WaitAsync on Task
You can more easily wait for an asynchronous task to execute, if it times out, it throws a "TimeoutException"
New math API
New methodology:
• SinCos • ReciprocalEstimate • ReciprocalSqrtEstimate
New Overload:
• Min, Max, Abs, Sign, Clamp support for nint and nuint • DivRem returns a tuple, including the quotient and remainder
CollectionsMarshal.GetValueRefOrNullRef
This is used when looping or modifying knot variable structures in the dictionary, which can reduce the copy copying of the structure and avoid the dictionary from repeatedly hashing calculations
The hyperlink login is visible.
ConfigureHostOptions
The new ConfigureHostOptions API on IHostBuilder makes it easier to configure applications.
Async Scope
.NET 6 introduces a new CreateAsyncScope method that throws an exception when you deal with an IAsyncDisposable service, which can be perfectly solved with CreateAsyncScope.
Encryption simplification
• DecryptCbc • DecryptCfb • DecryptEcb • EncryptCbc • EncryptCfb • EncryptEcb
(End)
|