Build with an Azure free account. Get USD200 credit for 30 days and 12 months of free services.

Start free today

C# Source Generators

Play C# Source Generators

The Discussion

  • User profile image
    Paula Scholz

    Could the [AutoNotify] attribute be modified to add serialization attributes to properties during generation?

    Also, can you stack attributes? For example, can I do this?


    public class Test
    {
    [AutoNotify]
    [AutoEquality]
    private int _id;
    }

    generates
    [DataContract]
    public class Test : INotifyPropertyChanged
    {
    ....INotifyPropertyChanged stuff......

    [DataMember]
    public int Id
    {
    get { return _id; }
    set { ...INotifyPropertyChanged stuff }
    }

    .... Equality stuff....

    }

  • User profile image
    Amirsas
    so basically u end up with 2 files the on you type, and 1 is auto generated. what do u do in the rest of the project? reference only the auto generated file?
    what is the necessary project setup to support this?

Add Your 2 Cents