String.join 和 string.join 的区别? ReSharper-"Name can be simplified"
Difference between String.join and string.join? ReSharper - "Name can be simplified"
我注意到这一点已经有一段时间了,我只是好奇 "simplifying" 这个名字是否有任何优势或好处。
示例:
var lst = new List<int> { 1, 2, 3, 4, 5 };
string commaLst = String.Join(",", lst);
ReSharper 然后说
Name can be simplified.
并建议我将 String.Join()
更改为 string.Join()
在性能或类似方面,一种方法是否优于另一种方法?简化名称有什么意义?
string
在 C#
中是 String
的别名
In C#, string is an alias for the String class in .NET framework. In
fact, every C# type has an equivalent in .NET. As another example,
short and int in C# map to Int16 and Int32 in .NET. So, technically
there is no difference between string and String, but it is common
practice to declare a variable using C# keywords.
我注意到这一点已经有一段时间了,我只是好奇 "simplifying" 这个名字是否有任何优势或好处。
示例:
var lst = new List<int> { 1, 2, 3, 4, 5 };
string commaLst = String.Join(",", lst);
ReSharper 然后说
Name can be simplified.
并建议我将 String.Join()
更改为 string.Join()
在性能或类似方面,一种方法是否优于另一种方法?简化名称有什么意义?
string
在 C#
String
的别名
In C#, string is an alias for the String class in .NET framework. In fact, every C# type has an equivalent in .NET. As another example, short and int in C# map to Int16 and Int32 in .NET. So, technically there is no difference between string and String, but it is common practice to declare a variable using C# keywords.