String or string

Possible Duplicate:
In C# what is the difference between String and string

what's the difference between the String and string. In C#, which is preferred?


Actually string is an alias for System.String but erash is basically right...

Here is a list of other alias' shamelessly lifted from Jon Skeet in this post:

* object: System.Object
* string: System.String
* bool: System.Boolean
* byte: System.Byte
* sbyte: System.SByte
* short: System.Int16
* ushort: System.UInt16
* int: System.Int32
* uint: System.UInt32
* long: System.Int64
* ulong: System.UInt64
* float: System.Single
* double: System.Double
* decimal: System.Decimal
* char: System.Char

They are the same this, string is an alias for String.

I tend to use String when calling static methods (ie, String.Format(...) or String.IsNullOrEmpty(...). I don't know why, I just do.


string is just an alias for String -- they are the same

edit: type fixed

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

上一篇: 在C#中有什么区别:string vs String

下一篇: 字符串或字符串