String or string

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

what is the difference between line and line. In C #, which is preferred?

+7
c #
source share
4 answers

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

Here is a list of other aliases "shamelessly removed from John 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 
+5
source share

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

I'm trying to use String when calling static methods (i.e. String.Format (...) or String.IsNullOrEmpty (...). I don't know why, I'm just doing.

+2
source share

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

change: fixed type

+1
source share

string is a C # keyword that means the same as the System.String type. Prefer language keywords where possible, so use, for example, string , int , float instead of System.String , System.Int32 , System.Single .

+1
source share

All Articles