Skip to content
0:00 / 0:00

#.net7#stringsyntaxattribute#c#

The .NET 7 feature that gives meaning to your Strings

Nick Chapsas

429K subscribers • 62 videos on Hallway

YouTube
  • Recommended by 1 person: 1 on Stack Overflow and its sister sites.
  • Presented by Nick Chapsas

Intermediate. Assumes working knowledge.

49K views4 years ago1 recommendation

Programming languagesC# and .NET

Nick Chapsas introduces the StringSyntax attribute in .NET 7, which enables syntax highlighting and autocomplete for strings in IDEs.

Check out my courses: dometrain.com Become a Patreon and get source code access: patreon.com/nickchapsas Hello everybody I'm Nick and in this video I will introduce you to a new feature that's being added in .NET 7 which makes working with strings way easier. It adds meaning to the simple string type and makes IDEs take advantage of their existing autocomplete and syntax highlighting logic to make it easier for you to work with special string types. Don't forget to comment, like and subscribe :) Social Media: Follow me on GitHub: bit.ly/ChapsasGitHub Follow me on Twitter: bit.ly/ChapsasTwitter Connect on LinkedIn: bit.ly/ChapsasLinkedIn Keep coding merch: keepcoding.shop #csharp #dotnet

Why it's here

1 person recommends this

What people say. Recommended for understanding how Visual Studio syntax-highlights strings in constructors.

Peter Rieszon Stack Overflow • Recommends

On “How does Visual Studio syntax-highlight strings in the Regex constructor?”

.NET 7 introduces the new StringSyntax(...) attribute, which is used in .NET 7 on more than 350 string , string[] , and ReadOnlySpan<char> parameters, properties, and fields to highlight to an interested tool what kind of syntax is expected to be passed or set. — https://devblogs.microsoft.com/dotnet/regular-expression-improvements-in-dotnet-7/#stringsyntaxattribute.regex So for a method argument, you should just use: void MyMethod(StringSyntax(StringSyntaxAttribute.Regex) string regex); Here is a video demonstrating the feature: link to this video