String vs string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am curious about declaring strings in C#. I see strings declared like:
string mystring = "something";
I also see:
String mystring = "something";

What is the difference?
 
I am curious about declaring strings in C#. I see strings declared like:
string mystring = "something";
I also see:
String mystring = "something";

What is the difference?

string is an alias of String.... there's no difference!
 
Robert said:
I am curious about declaring strings in C#. I see strings declared
like: string mystring = "something";
I also see:
String mystring = "something";

What is the difference?

Short answer: No difference.

Long answer:
The actual class name in the BLC is System.String. "string" a C#
language keyword that is mapped to System.String, just like "int" is
mapped to System.Int32, or "object" is mapped to System.Object.

Cheers,
 
Back
Top