Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String vs string [duplicate]

In C# there are String objects and string objects.

What is the difference between the two? What are the best practices regarding which to use?

like image 586
wusher Avatar asked Sep 22 '08 18:09

wusher


People also ask

What is string copy in c#?

Copy(String) Method is used to create a new instance of String with the same value as a specified String. In other words, this method is used to copy the data of one string into a new string. The new string contains same data like an original string but represents a different object reference.

What is the difference between string and string in C #?

string is an alias in the C# language for System. String . Both of them are compiled to System. String in IL (Intermediate Language), so there is no difference.

What is string clone?

In C#, Clone() is a String method. It is used to clone the string object, which returns another copy of that data. In other words, it returns a reference to this instance of String. The return value will be only another view of the same data. Clone method called directly on current String instance.

Which method of string class copies and returns part of an existing string object?

The Copy method returns a String object that has the same value as the original string but represents a different object reference. It differs from an assignment operation, which assigns an existing string reference to an additional object variable.


1 Answers

There is no difference. string (lower case) is just an alias for System.String.

like image 57
Ben Hoffstein Avatar answered Sep 29 '22 01:09

Ben Hoffstein