CSharp examples for Language Basics:string
The + operator concatenates two strings:
using System;//from w w w. ja v a 2 s . com class Test { static void Main(){ string s = "a" + "b"; Console.WriteLine (s); } }
One of the operands may be a nonstring value, in which case ToString is called on that value. For example:
using System;//from w w w .j av a 2 s. c om class Test { static void Main(){ string s = "a" + 5; // a5 Console.WriteLine (s); } }