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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top