简体   繁体   English

如何将resharpers默认访问修饰符更改为public而不是内部生成的类?

[英]How to change resharpers default access modifier to public instead of internal for generated classes?

when you auto generate a class, by default resharper seems to go with internal class Blah , but I'd like it to default to public class Blah 当你自动生成一个类时,默认情况下resharper似乎与internal class Blah一起使用,但是我希望它默认为public class Blah

I can understand why, because at that moment of generation, it is only internally scoped, but very quickly I will use it publicly scoped. 我可以理解为什么,因为在生成的那一刻,它只是内部范围,但很快我会公开使用它。 Which requires an auto fixup, which is just annoying. 这需要一个自动修复,这只是烦人的。 I'd like to be able specify the default access modifier 我希望能够指定默认访问修饰符

I have 2017.1.2 我有2017.1.2

The way I generate the class is as following :- 我生成课程的方式如下: -

var x = new Blah() ALT + ENTER -> Create Type /Generate Class var x = new Blah() ALT + ENTER - > Create Type / Generate Class

在此输入图像描述

You have to modify the templates. 您必须修改模板。 Resharper => Tools => Template Explorer choose Live/File Templates for the c#. Resharper =>工具=>模板资源管理器为c#选择实时/文件模板。 Now you can edit to whatever you like. 现在您可以编辑任何您喜欢的内容。

Templates Explorer Window 模板浏览器窗口

edit : 编辑

Seems that you are invoking through "quick fixes" suggestions. 似乎您正在调用“快速修复”建议。 Probably related to the "search/replace patterns". 可能与“搜索/替换模式”有关。 Didnt see the default exposed though. 虽然没有看到默认曝光。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Antlr 生成的类访问修饰符到内部 - Antlr generated classes access modifier to internal 如何将窗口的访问修饰符从公共更改为内部? - How can i change the Access Modifier of a Window from public to internal? Swig:如何将生成的 C# 类的可访问性从“公共类”更改为“内部类” - Swig: How to change the accessiblity of the generated C# classes from `public class` to `internal class` 修改公共财产的访问修饰符是一个突破性的变化吗? - Is it a breaking change that modifying the access modifier of a public property? Resharper建议对公开,内部或受保护的对象使用无效方法-如何始终拥有需求访问修饰符 - Resharper suggest void method to public, internal or protected - how to always have demand access modifier 将静态方法的修饰符从内部更改为公共是否是重大变化? - Is changing the modifier of a static method from internal to public a breaking change? 内部访问修饰符 - Internal access modifier 如何将App-GlobalResources文件夹中lang.resx的禁用访问修饰符更改为public? - how to change disabled access modifier of lang.resx within App-GlobalResources folder to public? 抽象类的访问修饰符 - Access modifier on abstract classes 用于自动生成的类的类修饰符 - Class modifier for automatically generated classes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM