Sunday, August 17, 2014

What's the Difference Between String and string in C#?

Answer:-

No Difference so you can use either of them in your code.

Explanation:-

In C#, keyword string which is defined in Base Class Library directly maps to Class System.String defined in Framework Class Library.

Quick Overview:-


String:
1) String is a Class (System.String)
2) String is Reference Type

string:
1) string is an alias of System.String Class
2) string is Value Type
3) string is a C# keyword


As per my view, even though string and String mean the same and have no difference in performance of the application still it is better to use string, which is a C# language specific keyword.

No comments:

Post a Comment

Popular Posts