What is the difference between 'String' and 'string' in C#?
Ask by Ravi Vishwakarma
Updated 11 Jun 2024
String (with capital 'S'):
System.String.Substring(),Length,IndexOf(), etc.string (with lowercase 's'):
Here's an example demonstrating the use of 'String' and 'string':
In practice, you'll often see 'string' used for variable declarations and 'String' used when referring to the class itself or when explicit type specification is necessary. However, both refer to the same string data type in C#.