Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What has been updated by Category 8?

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what has been updated in Category 8". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

.net Core 3 Preview 2 has been released, which mainly brings new features related to C # 8, which is part of the .NET Core 3 SDK.

C # 8 uses patterns for more operations, and the main features include:

Using statement

To change the way you need to indent the code, you can now write the following code that appends the using declaration to the scope of the current statement block and then places the object at the end of it.

Static void Main (string [] args) {

Using var options = Parse (args)

If (options ["verbose"]) {WriteLine ("Logging...");}} / / options disposed here

Switch expression

C # 8 introduces switch expressions, which support more concise syntax because it is an expression, so it returns a value and is fully integrated into pattern matching.

The switch keyword is "infix" and uses demo:

Static string Display (object o) = > o switch {Point {X: 0, Y: 0} = > "origin", Point {X: var x, Y: var y} = > $"({x}, {y})", _ = > "unknown"}

Or:

Static State ChangeState (State current, Transition transition, bool hasKey) = > (current, transition) switch {(Opened, Close) = > Closed, (Closed, Open) = > Opened, (Closed, Lock) when hasKey = > Locked, (Locked, Unlock) when hasKey = > Closed, _ = > throw new InvalidOperationException ($"Invalid transition")}

Asynchronous flow

Asynchronous flow is another major improvement of C # 8, which requires a compiler and framework library match to work properly. If you are developing with Visual Studio 2019 Preview 2 or the latest preview version of Visual Studio Code's C# extension, you need .NET Core 3.0 Preview 2 to use asynchronous flows.

In addition to the changes related to C# 8, the following updates are included:

IEEE floating point improvement

Net platform depends on the improvement of intrinsic function

A new fast JSON Writer & JSON document has been introduced

GPIO supports Raspberry Pi

Assembly unloadability

Windows native interoperability

This is the end of the content of "what has been updated in Category 8". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report