简体   繁体   中英

How can I prevent the generated implementation of an interface from using a type alias?

I'm currently using Visual Studio (specifically, 2012 Express). I have an interface already defined as follows:

interface IMyInterface
{
    public String Data { get; set; }
}

If I have an empty class:

class MyClass : IMyInterface
{
}

And I right-click on the IMyInterface , I can select "Implement Interface". When I do this, the auto-generated code produces the following:

class MyClass : IMyInterface
{
    public string Data
    {
        get
        {
            throw new NotImplementedException();
        }
        set
        {
            throw new NotImplementedException();
        }
    }
}

My question is, is there a way that I could have the following auto-generated:

    public String Data

Instead of:

    public string Data

?

There is no way to do this. It's hard-coded to use the builtin aliases where possible.

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