-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Diagnostics
Description
Background and motivation
It would be very helpful for the source generator scenario if we had a StringSyntax for C#:
- syntax error checking
- code completion inside strings
API Proposal
namespace System.Diagnostics.CodeAnalysis;
public sealed class StringSyntaxAttribute : Attribute
{
public const string CSharp = "C#";
}API Usage
using System.Diagnostics.CodeAnalysis;
public class Class
{
[StringSyntax(StringSyntaxAttribute.CSharp)]
public string? CodeForSourceGenerator = " ... c# code here";
}Alternative Designs
No response
Risks
No response
WeihanLi, PaulusParssinen and colejohnson66
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Diagnostics