Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In C# what is the difference: string vs String [duplicate]

Tags:

string

c#

.net

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

In C# there is string and there is System.String.

What is the difference between these? Is one considered better to use that the other. Are there any hidden dangers in mixing the use of them?

If they are the same, then why have them both? Why not just have one or the other?

like image 372
Vaccano Avatar asked Feb 10 '10 23:02

Vaccano


People also ask

What is '~' in C language?

In mathematics, the tilde often represents approximation, especially when used in duplicate, and is sometimes called the "equivalency sign." In regular expressions, the tilde is used as an operator in pattern matching, and in C programming, it is used as a bitwise operator representing a unary negation (i.e., "bitwise ...

What does the || mean in C?

The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise.

What does -= mean in C++?

-= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand. C -= A is equivalent to C = C - A.


2 Answers

System.String is the name of the actual .NET CLR class, just like System.Int32 is the real name of that class. But the designers of C# wanted it to look a lot like C and C++, where the native types (like int) are in lower case, so they added aliases for the basic native types.

like image 108
James Curran Avatar answered Sep 22 '22 20:09

James Curran


There is no difference.

http://msdn.microsoft.com/en-us/library/362314fe.aspx

The string type represents a sequence of zero or more Unicode characters. string is an alias for String in the .NET Framework.

like image 44
Cory Charlton Avatar answered Sep 19 '22 20:09

Cory Charlton