What is difference between string keyword and String Class. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is difference between string keyword and String Class.

What is difference between string keyword and String Class while using in C#. Which is useful and where ?

26th Oct 2017, 2:12 PM
Muhammad Saleem Kalro
Muhammad Saleem Kalro - avatar
2 Answers
+ 1
There's no difference
26th Oct 2017, 2:46 PM
Slifer
Slifer - avatar
0
Side note on that, if you save the same string to two variables, the string object will point to the same reference. String var1= “hi” String var2=“hi” But if you use the new keyword, you’ll have two separate objects pointing to two separate references. String var1 = “hi” Sting var2 = new String (“hi” )
14th Nov 2017, 7:05 AM
Khalil Shakir
Khalil Shakir - avatar