Събитие
Създаване на интелигентни приложения
17.03, 23 ч. - 21.03, 23 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаТози браузър вече не се поддържа.
Надстройте до Microsoft Edge, за да се възползвате от най-новите функции, актуализации на защитата и техническа поддръжка.
.NET 7 is the successor to .NET 6 and focuses on being unified, modern, simple, and fast. .NET 7 will be supported for 18 months as a standard-term support (STS) release (previously known as a current release).
This article lists the new features of .NET 7 and provides links to more detailed information on each.
Performance is a key focus of .NET 7, and all of its features are designed with performance in mind. In addition, .NET 7 includes the following enhancements aimed purely at performance:
<TieredPGO>true</TieredPGO>
to your project file). PGO can also instrument and optimize additional things, such as delegates.For a detailed look at many of the performance-focused features that make .NET 7 so fast, see the Performance improvements in .NET 7 blog post.
.NET 7 includes improvements to System.Text.Json serialization in the following areas:
For information about these and other updates, see the What's new in System.Text.Json in .NET 7 blog post.
.NET 7 and C# 11 include innovations that allow you to perform mathematical operations generically—that is, without having to know the exact type you're working with. For example, if you wanted to write a method that adds two numbers, previously you had to add an overload of the method for each type. Now you can write a single, generic method, where the type parameter is constrained to be a number-like type. For more information, see the Generic math article and the Generic math blog post.
.NET's regular expression library has seen significant functional and performance improvements in .NET 7:
The new option RegexOptions.NonBacktracking enables matching using an approach that avoids backtracking and guarantees linear-time processing in the length of the input. The nonbacktracking engine can't be used in a right-to-left search and has a few other restrictions, but is fast for all regular expressions and inputs. For more information, see Nonbacktracking mode.
Regular expression source generators are new. Source generators build an engine that's optimized for your pattern at compile time, providing throughput performance benefits. The source that's emitted is part of your project, so you can view and debug it. In addition, a new source-generator diagnostic SYSLIB1045
alerts you to places you use Regex that could be converted to the source generator. For more information, see .NET regular expression source generators.
For case-insensitive searches, .NET 7 includes large performance gains. The gains come because specifying RegexOptions.IgnoreCase no longer calls ToLower on each character in the pattern and on each character in the input. Instead, all casing-related work is done when the Regex is constructed.
Regex now supports spans for some APIs. The following new methods have been added as part of this support:
For more information about these and other improvements, see the Regular expression improvements in .NET 7 blog post.
Many improvements have been made to .NET library APIs. Some are mentioned in other, dedicated sections of this article. Some others are summarized in the following table.
Description | APIs | Further information |
---|---|---|
Support for microseconds and nanoseconds in TimeSpan, TimeOnly, DateTime, and DateTimeOffset types | - DateTime.Microsecond - DateTime.Nanosecond - DateTime.AddMicroseconds(Double) - New DateTime constructor overloads - DateTimeOffset.Microsecond - DateTimeOffset.Nanosecond - DateTimeOffset.AddMicroseconds(Double) - New DateTimeOffset constructor overloads - TimeOnly.Microsecond - TimeOnly.Nanosecond - TimeSpan.Microseconds - TimeSpan.Nanoseconds - TimeSpan.FromMicroseconds(Double) - And others... |
These APIs mean you no longer have to perform computations on the "tick" value to determine microsecond and nanosecond values. For more information, see the .NET 7 Preview 4 blog post. |
APIs for reading, writing, archiving, and extracting Tar archives | System.Formats.Tar | For more information, see the .NET 7 Preview 4 and .NET 7 Preview 6 blog posts. |
Rate limiting APIs to protect a resource by keeping traffic at a safe level | RateLimiter and others in the System.Threading.RateLimiting NuGet package | For more information, see Rate limit an HTTP handler in .NET and Announcing rate limiting for .NET. |
APIs to read all the data from a Stream | - Stream.ReadExactly - Stream.ReadAtLeast |
Stream.Read may return less data than what's available in the stream. The new ReadExactly methods read exactly the number of bytes requested, and the new ReadAtLeast methods read at least the number of bytes requested. For more information, see the .NET 7 Preview 5 blog post. |
New type converters for DateOnly , TimeOnly , Int128 , UInt128 , and Half |
In the System.ComponentModel namespace: - DateOnlyConverter - TimeOnlyConverter - Int128Converter - UInt128Converter - HalfConverter |
Type converters are often used to convert value types to and from a string. These new APIs add type converters for types that were added more recently. |
Metrics support for IMemoryCache | - MemoryCacheStatistics - MemoryCache.GetCurrentStatistics() |
GetCurrentStatistics() lets you use event counters or metrics APIs to track statistics for one or more memory caches. For more information, see the .NET 7 Preview 4 blog post. |
APIs to get and set Unix file permissions | - System.IO.UnixFileMode enum - File.GetUnixFileMode - File.SetUnixFileMode - FileSystemInfo.UnixFileMode - Directory.CreateDirectory(String, UnixFileMode) - FileStreamOptions.UnixCreateMode |
For more information, see the .NET 7 Preview 7 blog post. |
Attribute to indicate what kind of syntax is expected in a string | StringSyntaxAttribute | For example, you can specify that a string parameter expects a regular expression by attributing the parameter with [StringSyntax(StringSyntaxAttribute.Regex)] . |
APIs to interop with JavaScript when running in the browser or other WebAssembly architectures | System.Runtime.InteropServices.JavaScript | JavaScript apps can use the expanded WebAssembly support in .NET 7 to reuse .NET libraries from JavaScript. For more information, see Use .NET from any JavaScript app in .NET 7. |
.NET 7 makes improvements to observability. Observability helps you understand the state of your app as it scales and as the technical complexity increases. .NET's observability implementation is primarily built around OpenTelemetry. Improvements include:
For more information, see the .NET 7 Preview 4 blog post.
The .NET 7 SDK improves the CLI template experience. It also enables publishing to containers, and central package management with NuGet.
Some welcome improvements have been made to the dotnet new
command and to template authoring.
The dotnet new
CLI command, which creates a new project, configuration file, or solution based on a template, now supports tab completion for exploring:
In addition, for better conformity, the install
, uninstall
, search
, list
, and update
subcommands no longer have the --
prefix.
Template constraints, a new concept for .NET 7, let you define the context in which your templates are allowed. Constraints help the template engine determine which templates it should show in commands like dotnet new list
. You can constrain your template to an operating system, a template engine host (for example, the .NET CLI or New Project dialog in Visual Studio), and an installed workload. You define constraints in your template's configuration file.
Also in the template configuration file, you can now annotate a template parameter as allowing multiple values. For example, the web
template allows multiple forms of authentication.
For more information, see the .NET 7 Preview 6 blog post.
Containers are one of the easiest ways to distribute and run a wide variety of applications and services in the cloud. Container images are now a supported output type of the .NET SDK, and you can create containerized versions of your applications using dotnet publish
. For more information about the feature, see Announcing built-in container support for the .NET SDK. For a tutorial, see Containerize a .NET app with dotnet publish.
You can now manage common dependencies in your projects from one location using NuGet's central package management (CPM) feature. To enable it, you add a Directory.Packages.props file to the root of your repository. In this file, set the MSBuild property ManagePackageVersionsCentrally
to true
and add versions for common package dependency using PackageVersion
items. Then, in the individual project files, you can omit Version
attributes from any PackageReference items that refer to centrally managed packages.
For more information, see Central package management.
.NET 7 introduces a source generator for platform invokes (P/Invokes) in C#. The source generator looks for LibraryImportAttribute on static
, partial
methods to trigger compile-time source generation of marshalling code. By generating the marshalling code at compile time, no IL stub needs to be generated at run time, as it does when using DllImportAttribute. The source generator improves application performance and also allows the app to be ahead-of-time (AOT) compiled. For more information, see Source generation for platform invokes and Use custom marshallers in source-generated P/Invokes.
This section contains information about related products that have releases that coincide with the .NET 7 release.
For more information, see What's new in Visual Studio 2022.
C# 11 includes support for generic math, raw string literals, file-scoped types, and other new features. For more information, see What's new in C# 11.
F# 7 continues the journey to make the language simpler and improve performance and interop with new C# features. For more information, see Announcing F# 7.
.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. It unifies Android, iOS, macOS, and Windows APIs into a single API. For information about the latest updates, see What's new in .NET MAUI for .NET 7.
ASP.NET Core 7.0 includes rate-limiting middleware, improvements to minimal APIs, and gRPC JSON transcoding. For information about all the updates, see What's new in ASP.NET Core 7.
Entity Framework Core 7.0 includes provider-agnostic support for JSON columns, improved performance for saving changes, and custom reverse engineering templates. For information about all the updates, see What's new in EF Core 7.0.
Much work has gone into Windows Forms for .NET 7. Improvements have been made in the following areas:
For more information, see What's new in Windows Forms in .NET 7.
WPF in .NET 7 includes numerous bug fixes as well as performance and accessibility improvements. For more information, see the What's new for WPF in .NET 7 blog post.
Orleans is a cross-platform framework for building robust, scalable distributed applications. For information about the latest updates for Orleans, see Migrate from Orleans 3.x to 7.0.
The .NET Upgrade Assistant now supports upgrading server-side WCF apps to CoreWCF, which is a community-created port of WCF to .NET (Core). For more information, see Upgrade a WCF server-side project to use CoreWCF.
ML.NET now includes a text classification API that makes it easy to train custom text classification models using the latest state-of-the-art deep learning techniques. For more information, see the What's new with AutoML and tooling and Introducing the ML.NET Text Classification API blog posts.
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка:
Събитие
Създаване на интелигентни приложения
17.03, 23 ч. - 21.03, 23 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаОбучение
Пътека за обучение
Create cloud-native apps and services with .NET and ASP.NET Core - Training
Create independently deployable, highly scalable, and resilient apps and services using the free and open-source .NET platform. With .NET you can use popular microservice technology like Docker, Kubernetes, Dapr, Azure Container Registry, and more for .NET and ASP.NET Core applications and services.
Сертифициране
Microsoft Certified: Azure AI Fundamentals - Certifications
Demonstrate fundamental AI concepts related to the development of software and services of Microsoft Azure to create AI solutions.