Blog Logo
TAGS

Tagged Strings in Visual Studio and .NET 7

As part of .NET 7, developers now have the ability to tag strings using the StringSyntax attribute. These tags inform tools such as Visual Studio as to the nature of the string. Since StringSyntax is a normal attribute, Roslyn code analyzers could be written to warn about syntax errors in strings at compile time. This article discusses how to use the StringSyntax attribute and provides a list of built-in syntax types. Also included is a code-completion-like feature that displays the definition of formatting characters for date/time format strings. This article is written by Jonathan Allen and was published on InfoQ in the .NET topic. Writing for InfoQ has opened many doors and increased career opportunities for me, and you can do the same. Learn more about how to contribute to InfoQs community of experts and thought leaders by writing for us.