Answers for "What is the difference between String and string in C#?"

C#
3

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

string is an alias in C# for System.String.
So technically, there is no difference. It's like int vs. System.Int32

https://stackoverflow.com/questions/7074/what-is-the-difference-between-string-and-string-in-c
Posted by: Guest on November-16-2020
0

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

string place = "world";
string greet = String.Format("Hello {0}!", place);

/* string is an alias in C# for System.String.
So technically, there is no difference. It's like int vs. System.Int32.

As far as guidelines, it's generally recommended to use string any time you're referring to an object.

e.g.
*/
string place = "world";
/*
Likewise, I think it's generally recommended to use String if you
need to refer specifically to the class.

e.g.
*/
string greet = String.Format("Hello {0}!", place);
Posted by: Guest on July-01-2021

Code answers related to "What is the difference between String and string in C#?"

C# Answers by Framework

Browse Popular Code Answers by Language