Today I learned about the StringSyntaxAttribute added in .NET 7.

It’s a handy attribute you can add to string properties to specify exactly what format the string should be in.

This gives you extra IDE assistance like syntax highlighting and intellisense 馃敟.

screenshot of rider showing regex intellisense

And you can also use a comment like /*lang=xxx*/ for regular variables.

screenshot of comment annotation

Read Steve’s post for more detail.