为什么是“字符串"被认为是“字符串"的简化版本? [英] Why is "string" considered a simplified version of "String"?

查看:18
本文介绍了为什么是“字符串"被认为是“字符串"的简化版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C# 中,我通常在使用方法时使用 String,在声明变量时使用 string.我在别处读到这是保持事物清洁的首选方法,这对我来说很有意义.在 Visual Studio 2015 中,当我使用 String 时,我收到了一条我以前从未收到过的新消息:名称可以简化.VS 建议使用 string 代替.

In C# I usually use String when I'm utilizing a method and string when declaring a variable. I read elsewhere that this is the preferred method to keep things clean and that made sense to me. In Visual Studio 2015, I'm getting a new message I haven't gotten before when I use String: Name can be simplified. The VS suggestion is to use string instead.

为什么在 VS2015 中 string 现在比 String 更受欢迎,而在 2013 年则不然??

Why is string now preferred over String in VS2015 whereas it wasn't in 2013??

不是这个问题的副本.那个问总体上有什么区别,我在问为什么 VS 现在建议一个而不是另一个;我不知道是不是技术上的差异发生了变化,或者有什么影响.

Not a duplicate of this question. That one asks what the difference is overall, I'm asking why VS is now suggesting one over the other; I don't know if a technical difference has changed or something to that effect.

推荐答案

因为您没有取消选中在声明局部变量、参数和成员时优先使用内部预定义类型关键字"在下面找到工具 > 选项 > 文本编辑器 > C# > 代码样式

Because you didn't uncheck "Prefer intrinsic predefined type keyword when declaring locals, parameters and members" found under Tools > Options > Text Editor > C# > Code Style

这篇关于为什么是“字符串"被认为是“字符串"的简化版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆