C# 11 officially released

C# 11 is now released. “With each release, the community has become increasingly engaged, contributing everything from suggestions, insights, and bug reports to entire feature implementations. This really is C# for everyone,” the announcement said.
Some of the highlights of the new release include:

UTF-8 String Literals

By default, C# strings are hardcoded as UTF-16, while the common string encoding on the Internet is UTF-8. To minimize the hassle and performance overhead of conversion, it is now possible to simply append a u8 suffix to your string literals to instantly convert them to UTF-8:

 var u8 = "This is a UTF-8 string!"u8;

UTF-8 string literals just return you a chunk of bytes — in the form of ReadOnlySpan<byte> . For those scenarios that require UTF-8 encoding, this may be better than some dedicated new UTF-8…

The post C# 11 Official Release first appeared on Lenix Blog .

This article is transferred from https://blog.p2hp.com/archives/10112
This site is only for collection, and the copyright belongs to the original author.