c#: String class vs string struct

Possible Duplicate:
What's the difference between String and string?

I have been some time working with C# and i have ever noticed any diference between both types.

String myStringAsClass;
string myStringAsStruct;

Is there any diference other than the clarification you may use on the code or convetion to use the static functions from String class and declarations from string struct?

Thank you very much!


They are the same. They are both reference types.

System.String == string
System.Object == object
System.Int32 == int
System.Int64 == long

...etc.


stringSystem.String的别名,就像intSystem.Int32的别名一样。


There IS a difference between a class and a struct in C#. However that is irrelevant here since

String == string and both are class

So, to summarize, there is NO difference between the two, and string is a class.

链接地址: http://www.djcxy.com/p/3606.html

上一篇: 布尔和布尔在C#之间的区别?

下一篇: c#:String类与字符串结构