Relating C# Keywords to .NET Types

Learn about the C# type keywords, which are aliases for corresponding .NET types.

One of the common questions is, “What is the difference between a string with a lowercase s and a String with an uppercase S?”

The short answer is easy: none. The long answer is that all C# type keywords, like string or int are aliases for a .NET type in a class library assembly.

Mapping the keyword to type

When we use the string keyword, the compiler recognizes it as a System.String type. When we use the int keyword, the compiler recognizes it as a System.Int32 type. Let’s see this in action with some code:

Step 1: In Program.cs, declare two variables to hold string values, one using lowercase string and one using uppercase String, as shown in the following code:

Get hands-on with 1400+ tech skills courses.