简体   繁体   中英

is the c# compiler exentisble?

Is there any way to add your own language extension?

For example make it so:

public string Foo { get; set; }

can be coded as:

public auto string Foo;

No, but you can just type

prop

in Visual Studio, press Tab (maybe twice), and voilà! You get what you wanted. :D

Nope - you can't extend the C# compiler in this way.

You should be thankful it's that short, you used to have to write:

public string Foo
{
    get
    {
        return this.foo;
    }
    set
    {
        this.foo = value;
    }
}
private string foo;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM