Tuesday, July 28, 2009

What is Difference between String and string in C#?

String (capital S) is a class name which inculdes constructor, methods, members, and properties of its own.


and it represents text as 'Unicode' characters





string (small s) is the method of how you can create a new string (array of characters), ex: "string str1;".


and string type represnts a string of 'Unicode' characters

What is Difference between String and string in C#?
This question keeps recurring in under this board.





String and string are aliases there is absolutely NO difference of which to use.





String is the .NET type (Common Type System) under C#'s string. This is basically the same concept in System.Int32 and C#'s int.





hence writing


System.Int32 myInteger;





is equivalent to writing:


int myInteger;





or System.String MyString;


is the same as string MyString;





Hope this helps
Reply:One isn't in major.


No comments:

Post a Comment