What is the difference between String and string in C#? Are they different types?
Hello everyone! I recently started learning C# and one thing confuses me. In different code examples, I see strings declared differently: some write `string name = "John";`, while others write `String name = "John";`. Both work, IntelliSense doesn't complain. But aren't these different names? Maybe `String` is a class from .NET, and `string` is some primitive type? Or are they the same thing?
I tried writing this code:
```csharp
string a = "Hello";
String b = "World";
Console.WriteLine(a.GetType()); // System.String
Console.WriteLine(b.GetType()); // System.String
Console.WriteLine(a == b); // True
```
Both times it outputs `System.String`, and the comparison works. But if they are the same, why have two names? Maybe there is some difference in performance or
No answers yet.
Log in to leave an answer