System.String and string in C#

Confusing about which one to use? Don’t be, they are the same! “string” is C# alias of type System.String. Both string and String are compiled down to System.String in IL, very much like int for System.Int32. There’s no performance implication in any way. I recalled a forum answer mentioned something about String is kept on heap and string is on stack, but that is not true. I find most organic C# developers use “string”, but ones with background in Java go for “String”. Which one to use is only a matter of style :).

Teera on October 18th 2008 in Software Development, .NET

Trackback URI | Comments RSS

Leave a Reply