Karl Gjertsen

Architect, Developer, Speaker, Bad Golfer,
Raygun brand ambassador and creator of Infiniforms

C#: When to use String vs string

This seems to be a common question from people who are new to programming in C#.

The answer is that it doesn’t matter which you use as string is an alias for System.String.

However, the convention is to use ‘string’ when you are referring to an object and ‘String’ when you are referring specifically to the string class.

Example of string:

string name = "Karl";

Example of System.String:

%d bloggers like this: