Is there any way for Visual Studio to create my interface 'public'? For example, right click on folder -> create new item -> code -> interface.
Whenever the file is created there are no access modifiers.
interface IMyInterface
{
}
Is there any way to default it to make it public?
public interface IMyInterface
{
}
I'm always forgetting to manually change them to public (when they need to be).
Open your project with the public IMyInterface
interface shown above.
Go to File > Export Template
.
Follow the steps (make sure you choose item template rather than Project template) and save it under a name of your choice.
When you restart visual studio and have a project open it will be available from the add item dialog. You will be able to set the name of the interface from the dialog just like you can with the other items.
Note that this does not overwrite the default interface template installed with Visual Studio so you can still just as easily make a private interface when required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With