Quantcast
Channel: What is the difference between String and string in C#? - Stack Overflow
Browsing all 69 articles
Browse latest View live

Answer by Inverted Llama for What is the difference between String and string...

String refers to a string object which comes with various functions for manipulating the contained string.string refers to a primitive type In C# they both compile to String but in other languages they...

View Article


Answer by Zaid Masud for What is the difference between String and string in C#?

One argument not mentioned elsewhere to prefer the pascal case String:System.String is a reference type, and reference types names are pascal case by convention.

View Article


Answer by Michael Ray Lovett for What is the difference between String and...

Coming late to the party: I use the CLR types 100% of the time (well, except if forced to use the C# type, but I don't remember when the last time that was). I originally started doing this years ago,...

View Article

Answer by Joe Alfano for What is the difference between String and string in C#?

String (System.String) is a class in the base class library. string (lower case) is a reserved work in C# that is an alias for System.String. Int32 vs int is a similar situation as is Boolean vs. bool....

View Article

Answer by Oded for What is the difference between String and string in C#?

There is no difference.The C# keyword string maps to the .NET type System.String - it is an alias that keeps to the naming conventions of the language.Similarly, int maps to System.Int32.

View Article


Answer by JeeShen Lee for What is the difference between String and string in...

string is an alias (or shorthand) of System.String. That means, by typing string we meant System.String. You can read more in think link: 'string' is an alias/shorthand of System.String.

View Article

Answer by Dot NET for What is the difference between String and string in C#?

There is no difference between the two - string, however, appears to be the preferred option when considering other developers' source code.

View Article

Answer by RolandK for What is the difference between String and string in C#?

Against what seems to be common practice among other programmers, I prefer String over string, just to highlight the fact that String is a reference type, as Jon Skeet mentioned.

View Article


Answer by user576533 for What is the difference between String and string in C#?

String is not a keyword and it can be used as Identifier whereas string is a keyword and cannot be used as Identifier. And in function point of view both are same.

View Article


Answer by claudioalpereira for What is the difference between String and...

I'd just like to add this to lfousts answer, from Ritchers book:The C# language specification states, “As a matter of style, use of the keyword is favored over use of the complete system type name.” I...

View Article

Answer by Rasmus Faber for What is the difference between String and string...

C# is a language which is used together with the CLR.string is a type in C#.System.String is a type in the CLR.When you use C# together with the CLR string will be mapped to...

View Article

Answer by Simon_Weaver for What is the difference between String and string...

string is a reserved word, but String is just a class name. This means that string cannot be used as a variable name by itself.If for some reason you wanted a variable called string, you'd see only the...

View Article

Answer by Lloyd Cotten for What is the difference between String and string...

As the others are saying, they're the same. StyleCop rules, by default, will enforce you to use string as a C# code style best practice, except when referencing System.String static functions, such as...

View Article


Answer by TraumaPony for What is the difference between String and string in C#?

It's been covered above; however, you can't use string in reflection; you must use String.

View Article

Answer by Jon Skeet for What is the difference between String and string in C#?

Just for the sake of completeness, here's a brain dump of related information...As others have noted, string is an alias for System.String. Assuming your code using String compiles to System.String...

View Article


Answer by Pradeep Kumar Mishra for What is the difference between String and...

Both are same. But from coding guidelines perspective it's better to use string instead of String. This is what generally developers use. e.g. instead of using Int32 we use int as int is alias to...

View Article

Answer by artur02 for What is the difference between String and string in C#?

String stands for System.String and it is a .NET Framework type. string is an alias in the C# language for System.String. Both of them are compiled to System.String in IL (Intermediate Language), so...

View Article


Answer by Hallgrim for What is the difference between String and string in C#?

string is just an alias for System.String. The compiler will treat them identically.The only practical difference is the syntax highlighting as you mention, and that you have to write using System if...

View Article

Answer by TheSoftwareJedi for What is the difference between String and...

string and String are identical in all ways (except the uppercase "S"). There are no performance implications either way.Lowercase string is preferred in most projects due to the syntax highlighting

View Article

Answer by Ishmael for What is the difference between String and string in C#?

Using System types makes it easier to port between C# and VB.Net, if you are into that sort of thing.

View Article
Browsing all 69 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>