Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

String or string

  Asked By: Tye    Date: May 15    Category: Asp.net    Views: 1165
  

thought I'd ask ... someone please tell me the answer to a question on everyones
lips

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

String is, more often than not, used in properties


private string mystr

public String myStr
get {
return mystr;
}
set{
mystr.value = myStr;
}

but not always !

but what is the difference ?

and are ther any other ones that you can capitalize the first letter with no
apparant change to its meaning ?

are there any specific circumstances where you should use one and not the other
? I have to say I tend to plum for string every time, as it comes up blue in
editor so I know where I am with things.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Alfonsine Miller     Answered On: May 15

String and string  are the exact same thing. The .NET Framework
represents strings using the System.String class. In C#, string is an
alias for System.String. That is, the following three lines of C# code
are semantically identical:

string x;
String y;
System.String z;


In a similar vein, int is an alias for System.Int32, so the following
are also equivalent:

int x;
Int32 y;
System.Int32 z;

and so forth.

For more information, check out:
ms-help://MS.NETFrameworkSDK/csref/html/vclrfString.htm
ms-help://MS.NETFrameworkSDK/cpref/html/frlrfSystemStringClassTopic.htm

 
Didn't find what you were looking for? Find more on String or string Or get search suggestion and latest updates.




Tagged: