What’s New in .NET 8 Preview 5

Leave a Comment

.NET 8 Preview 5 was released on 06/13/2023 and introduced several new features and improvements.

 .NET 8 Preview 5 introduces several updates to the .NET SDK.

This includes an option to simplify the output path and folder structure for build outputs, a new "dotnet workload clean" command, and changes to "dotnet publish" and "dotnet pack" assets.

In addition to these changes to the .NET SDK, improvements have been made to core .NET libraries, extension libraries, and serialization.

A source generator for configuration binding has also been introduced.

Other notable updates include reflection improvements, native AOT support, performance improvements, and changes to .NET container images and .NET on Linux.

Overall, .NET 8 Preview 5 brings a lot of exciting new features and improvements.

One of the improvements is in the Interfaces Hierarchies, .NET 8 has added support for serializing properties from interface hierarchies.

When an object that implements an interface hierarchy is serialized, properties from all levels of the interface hierarchy are included in the serialized data.

IDerivedInterface value = new MyClass { BaseProperty = 0, DerivedProperty = 1 };
JsonSerializer.Serialize(value); // {"BaseProperty":0,"DerivedProperty":1}

public interface IBaseInterface
    int BaseProperty { get; set; }

public interface IDerivedInterface : IBaseInterface
    int DerivedProperty { get; set; }

public class MyClass : IDerivedInterface
    public int BaseProperty { get; set; }
    public int DerivedProperty { get; set; }

Another improvement is the new API Meter.

Metrics are measures of the behavior of a system. They help you understand your system's performance, health, and other aspects. For instance, you might have metrics for how many requests your server handles per second or how long it takes to process each request.

.NET 8 have added the ability to attach key-value pair tags to Meter and Instrument objects when they are created.

With the new API in .NET 8, you can add tags to your Meter and Instrument objects when you create them.

Aggregators can then use these tags to differentiate the values they aggregate. For instance, if you have a tag for "location", you might use it to separate measurements taken in different parts of your system.

MeterOptions options = new MeterOptions("name")
    Version = "version",
    // Attach these tags to the created meter
    Tags = new TagList() { { "MeterKey1", "MeterValue1" }, { "MeterKey2", "MeterValue2" } }

Meter meter = meterFactory.Create(options);

Instrument instrument = meter.CreateCounter<int>("counter", null, null, new TagList() { { "counterKey1", "counterValue1" } });

Windows Hosting Recommendation

HostForLIFEASP.NET receives Spotlight standing advantage award for providing recommended, cheap and fast ecommerce Hosting including the latest Magento. From the leading technology company, Microsoft. All the servers are equipped with the newest Windows Server 2012 R2, SQL Server 2022, ASP.NET 7.0.5, ASP.NET MVC, Silverlight 5, WebMatrix and Visual Studio Lightswitch. Security and performance are at the core of their Magento hosting operations to confirm every website and/or application hosted on their servers is highly secured and performs at optimum level. mutually of the European ASP.NET hosting suppliers, HostForLIFE guarantees 99.9% uptime and fast loading speed. From €3.49/month , HostForLIFE provides you with unlimited disk space, unlimited domains, unlimited bandwidth,etc, for your website hosting needs.


Next PostNewer Post Previous PostOlder Post Home


Post a Comment