CSharp examples for Language Basics:string
C#'s string type (aliasing the System.String type) represents an immutable sequence of Unicode characters.
A string literal is specified inside double quotes:
string a = "Heat";
string is a reference type, rather than a value type.
Its equality operators, however, follow value-type semantics:
using System;/*from www.j ava 2s.c om*/ class Test { static void Main(){ string a = "test"; string b = "test"; Console.Write (a == b); // True } }
The escape sequences that are valid for char literals also work inside strings:
using System;// w w w. j av a 2 s . co m class Test { static void Main(){ string a = "Here's a tab:\t"; Console.WriteLine (a); } }