append to string c# code example
Example 1: how to append something to a string in c#
string fName = "hello ";
string lName = "world";
string Name = string.Concat(fName, lName);
string firstName = "hello ";
string lastName = "world";
string name = firstName + " " + lastName;
Example 2: how add strings together
String firstName = "BarackObama";
String lastName = " Care";
System.out.println(firstName + lastName);
String name = firstName + lastName;
System.out.println(name);
System.out.println("BarackObama" + " Care");
Example 3: c# string concatenation
string userName = "<Type your name here>";
string dateString = DateTime.Today.ToShortDateString();
string str = "Hello " + userName + ". Today is " + dateString + ".";
System.Console.WriteLine(str);
str += " How are you today?";
System.Console.WriteLine(str);
Example 4: c# Add or Concatenate Strings In C#
string str1 = "ppp";
string strRes = str1.Insert(2, "bbb");
Console.WriteLine(strRes.ToString());