string vs. String - Does It Make A Difference?

  • Thread starter Thread starter Empire City
  • Start date Start date
E

Empire City

From the documentation string is an alias for System.String in the .net
framework. Is there any advantage to using one over the other more than
string is picked up as blue in the context sensitive code editor and I guess
an alias generates an extra line of code or something somewhere.
 
Wheather you use System.String or string there is no difference in generated
code since it is as, you already noticed, simply an alias for one and the
same thing.
When you are working with c# using the keyword string is preferred for
better readability.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

No it doesn't, they're exactly the same. What look like "primitive"
types in C#, such as int, float, long, string, etc. are actually just
aliases, i.e.: C# keywords that are there for convenience (i.e.: it is
much cleaner and C-like to type int instead of Int32 everytime).

This is of course different in Java, where int and java.lang.Integer are
two different things, and using int *is* more efficient than
java.lang.Integer...

RD

Empire City wrote:

| From the documentation string is an alias for System.String in the .net
| framework. Is there any advantage to using one over the other more than
| string is picked up as blue in the context sensitive code editor and I
guess
| an alias generates an extra line of code or something somewhere.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/m1YTwEwccQ4rWPgRAvE1AJ9CLocI7GsByEVD04BFPRUblmUDtACZAdpD
lWhIbwel+onSVGhkaXnHxAQ=
=b6Bu
-----END PGP SIGNATURE-----
 
Back
Top