What is the difference between 'String' and 'string' in C#?
258
11-Jun-2024
Ravi Vishwakarma
11-Jun-2024String (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#.