In Microsoft’s Visual Studio 17.1, users will get a sneak peek at features coming to C# 11. These features will also be available in .NET SDK 6.0.200.
A feature available in early preview is parameter null checking, which verifies at runtime if a null has been passed to code. This is separate from Nullable Reference Types (NRT), which identifies at design time if a null is possible.
Another new addition to the language is the ability to allow newlines in holes in non-verbatim interpolated strings. Holes, or interpolation expressions, are contained inside curly braces and supply runtime values. Previously newlines were allowed in verbatim interpolated strings, but in non-verbatim strings escapes, like \r or \n, were required instead.
C# 11 will also include list patterns, which allows developers to match elements against lists and arrays. In addition, developers will be able to include a slice pattern to match zero or more elements. List patterns work with types that are countable or indexable, while slice patterns work with types that are countable or sliceable.
Microsoft recommends users play around with these preview features, and can submit feedback in the C# repo on GitHub.
The post Microsoft gives sneak peek at C# 11 features in latest Visual Studio update appeared first on SD Times.
from SD Times https://ift.tt/Yb3Gkmn
Comments
Post a Comment