xxxxxxxxxx
string first = "hello_";
string second = "world";
/* Unite multiple strings to one new string*/
string third = String.Concat(first, second);
// string third will be now "hello_world"
xxxxxxxxxx
// Declare strings
string firstName = "Mahesh";
string lastName = "Chand";
// Concatenate two string variables
string name = firstName + " " + lastName;
Console.WriteLine(name);
xxxxxxxxxx
using System;
namespace Concatenate{
public class Program{
public static void Main()
{
string firstWord = "Hello";
string secondWord = " World!";
string concatenated = firstWord + secondWord;
Console.WriteLine(concatenated);
}
}
}
xxxxxxxxxx
string string1 = "c# is little bit";
string string2 = " tough at start only";
Console.WriteLine("------------Concatination--------------");
Console.WriteLine(string1+string2);
xxxxxxxxxx
string str1 = "ppp";
string strRes = str1.Insert(2, "bbb");
Console.WriteLine(strRes.ToString());