Menu

C# Auto Properties?

Anonymous
2016-04-07
2016-04-12
  • Anonymous

    Anonymous - 2016-04-07

    Is there a way to generate C# code with auto properties?
    Or is there any way one could implement it?

     
  • Janusz Szpilewski

    If you mean C# 3.0 style properties like int prop { get; set; } they are not supported as the currently handled version of C# is just 1.0 (to some extent).

     
  • Anonymous

    Anonymous - 2016-04-07

    Correct, any plans for this feature? Or could one implement it somehow in C# "plugin"?

     
  • Janusz Szpilewski

    I looked at it closer. Currently for an operation with Property stereotype and Get and Set Tagged Values C# plugin will generate something like:

    public int Prop1{
            get{
            }
            set{
            }
        }
    

    If the parent is an interface it will be:

     int Prop1{
            get;
            set;
        }
    

    The first version (for class) will never compile without manual adaptation (missing return) so probably it could be changed to behave like the interface as it is more likely to produce a compilable stub.

     
  • Anonymous

    Anonymous - 2016-04-12

    Ok it would be nice if C# profile were updated, and perhaps also with a field, where one can choose if it should be manual (whithout extra space for belonging operation) or auto property.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.