top of page

Difference Between String and string in C#

String (capital S) is a class in the .NET framework in the System namespace. The fully qualified name is System.String. Whereas, the lower case string is an alias of System.String.

It is recommended to use string (lower case) over String. However, it's a matter of choice. You can use any of them. Many developers use string to declare variables in C# and use System.String class to use any built-in string methods e.g., String.IsNullOrEmpty().


using System;

public class Program
	public static void Main()
		string str1 = "Hello";
		String str2 = "World!";

Difference Between String and string



It is a class used to access string variables and formatting methods

It is Keyword used to create a string variable

We have to import String from the System.String module

There is no need to import any module for string

It is a data type

It is s keyword

It also contains different types of methods, properties etc.,

It is only an alias of the System.String

.NET Alias

Alias .NET Type

byte System.Byte

sbyte System.SByte

int System.Int32

uint System.UInt32

short System.Int16

ushort System.UInt16

long System.Int64

ulong System.UInt64

float System.Single

double System.Double

char System.Char

bool System.Boolean

object System.Object

string System.String

decimal System.Decimal

DateTime System.DateTime

The Tech Platform

bottom of page