What is the difference between String and string in C#

In C#, string (lowercase) is a keyword and an alias for the System.String class. String (uppercase) is the actual .NET class name. Both are functionally identical and compile to the same IL code.

Most C# developers prefer using string (lowercase) as it follows the language's convention for built-in types like int, bool, and double.

The C# coding conventions recommend using the keyword alias when available.

C# Example Code
using System;

public class StringComparison
{
    public static void Main(string[] args)
    {
        // Both declarations are identical
        string lowerCase = "Hello World";
        String upperCase = "Hello World";

        // They are the same type
        Console.WriteLine(lowerCase.GetType());  // System.String
        Console.WriteLine(upperCase.GetType());  // System.String

        // ReferenceEquals proves they're the same type
        Console.WriteLine(lowerCase.GetType() == upperCase.GetType());  // True

        // Both have access to the same methods
        Console.WriteLine(lowerCase.ToUpper());  // HELLO WORLD
        Console.WriteLine(upperCase.ToLower());  // hello world

        // Convention: use lowercase 'string'
        string preferredStyle = "Use this style";
        Console.WriteLine(preferredStyle);
    }
}