SoFunction
Updated on 2025-03-08

Introduction to the difference between String and string in C#

I wonder if you have discovered that in the c# string type, you can write string and String, so what is the difference between them?

string is a class in c#;

String is a class of Framework;

C# string maps to Framework's String.

If you use string, the compiler will compile it into String, so if you use String directly, you can make the compiler do a little less work.

That is to say

string is just an alias for String