Skip to content

String vs string in C#

Stackoverflow has become a go-to resource for programming questions or discussions that I like to follow. One discussion that I stumbled on was the difference between String and string in C#.

According to the thread, String stands for System.String and is a .NET Framework type. string is an alias in the C# language for System.String. Both of them are compiled to System.String in IL (Intermediate Language), so there is no difference.

Here are some other aliases:

  • object: System.Object
  • string: System.String
  • bool: System.Boolean
  • byte: System.Byte
  • sbyte: System.SByte
  • short: System.Int16
  • ushort: System.UInt16
  • int: System.Int32
  • uint: System.UInt32
  • long: System.Int64
  • ulong: System.UInt64
  • float: System.Single
  • double: System.Double
  • decimal: System.Decimal
  • char: System.Char