Visual Studio 默认自动完成使用系统类型名称
奇怪的问题,但我的老板有点老派,并坚持在我们的编码标准中我们不使用 C# 简写系统类型,他喜欢我们使用完整的系统名称。他喜欢事情变得冗长,我很乐意遵守这个标准。
然而,几个月后开始让我恼火的是,Visual Studio 在完成代码时不喜欢遵守标准。因此,如果我输入:
KeyValuePair<Int32, Object> MyValue = new
Visual studio 将用以下内容完成其余部分:
KeyValuePair<int,object>
在实现接口或抽象类时,情况会更糟。
这是一个小小的不便,但仍然是一个不便,我想知道在众多的 VS 选项中是否有一个强制使用完整的系统类型名称。
我相信可以使用 Re-Sharper 之类的工具来解决这个问题,但不幸的是我无法获得许可证。
编辑
是的,他鄙视 var 关键字的使用。我应该说出他的实际推理,因为我们主要用 C# 开发,但很有可能需要用 C 和 Objective C 编写,所以他不希望我们过于依赖 CLR 简写,他还说这会导致移植代码时减少痛苦,这在某种程度上对我来说是有意义的。他这样做的主要目的是避免与 Int16、Int32 和 Int32 等类型的类型错误匹配。 Int64,但由于我们遵循标准,他更喜欢 String 而不是字符串。平心而论,他是一位非常优秀的编码员,即使不是老派,但他对底层事物的了解远远超过我和我认识的 90% 的开发人员,我想,他们都来自游戏背景,我想这会让你更欣赏更好的东西多点触摸。我一直被一个优秀的托管 .NET 框架宠坏了。
非常感谢
保罗
Strange question but my boss is a touch old school and has insisted in our coding standards that we do not use C# shorthands for system types, he likes us to use the full system name. He likes things to be verbose and I happily comply with the standard.
However, something which after several months has started to grate on me is the fact that visual studio does not like to comply with the standard when completing code. So if I type:
KeyValuePair<Int32, Object> MyValue = new
Visual studio will finish the rest with:
KeyValuePair<int,object>
This is even worse when implementing an interface or abstract class.
This is a minor inconveniance but one none the less and I was wondering whether in the plethora of VS options there was one to force using the full System type names.
I believe that this can be solved use something like Re-Sharper but unfortunately there's no way I'm getting a license.
EDIT
Yes he despises the use of the var keyword. I should have stated his actual reasoning, it's because we mostly develop in C# but there is a high probability of needing to write in C and objective C so he does not want us to become too reliant upon CLR shorthands and he also says it would cause less pain when porting code which to a degree makes sense to me. His main aim with this is to avoid type mis matches with types such as Int16, Int32 & Int64 but as we are following a standard he prefers String over string. In all fairness, he is a very good coder if not a touch old school but his knowledge of things under the hood is vastly greater than mine and 90% of devs that I know, coming from a gaming background I guess makes you appreciate the finer points a touch more. I've always been spoilt with a nice managed .NET framework.
Many Thanks
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的研究表明这是不可能的。也许在 Visual Studio 的未来版本中......
My research indicates this is not possible. Maybe in a future version of Visual Studio...