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

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

$
0
0

There is no major difference between string and String in C#.

String is a class in the .NET framework in the System namespace. The fully qualified name is System.String. The lower case string is an alias of System.String.

But its recommended to use string while declaring variables like:

string str = "Hello";

And we can use String while using any built-in method for strings like String.IsNullOrEmpty().

Also one difference between these two is like before using String we have to import system namespace in cs file and string can be used directly.


Viewing all articles
Browse latest Browse all 69

Trending Articles



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