Use the Concat() method to concatenate strings : String « String « C# / CSharp Tutorial






using System;

class MainClass
{

  public static void Main()
  {
    string myString4 = String.Concat("A, ", "B");
    Console.WriteLine("String.Concat(\"A, \", \"B\") = "+ myString4);
    string myString5 = String.Concat("A, ", "B, ", "and countrymen");
    Console.WriteLine("String.Concat(\"A, \", \"B, \", " + "\"and countrymen\") = " + myString5);
  }

}
String.Concat("A, ", "B") = A, B
String.Concat("A, ", "B, ", "and countrymen") = A, B, and countrymen








5.1.String
5.1.1.Declaration of string
5.1.2.String is object
5.1.3.String are immutable
5.1.4.Empty string
5.1.5.Display all the characters in myString using a for loop
5.1.6.Use Indexer to reference chars in a string
5.1.7.Use the Compare() method to compare strings
5.1.8.Use the Concat() method to concatenate strings
5.1.9.Use the addition operator (+) to concatenate strings
5.1.10.Use the Copy() method to copy a string
5.1.11.Use the Equals() method and equality operator to check if two strings are equal
5.1.12.Use the Format() method to format a string
5.1.13.Use the Join() method to join strings
5.1.14.Use the Split() method to split strings
5.1.15.Use the IndexOfAny() and LastIndexOfAny() methods to search for character arrays in a string
5.1.16.Use the Insert(), Remove(), and Replace() methods to modify strings
5.1.17.Use the PadLeft() and PadRight() methods to align strings
5.1.18.Use the Trim(), TrimStart(), and TrimEnd() methods to trim strings
5.1.19.Use the Substring() method to retrieve substrings
5.1.20.Working with Strings
5.1.21.Error; string Is Immutable
5.1.22.Basic String functionality
5.1.23.Is String Interned
5.1.24.Demonstrates the String.Normalize method and the String.IsNormalized method
5.1.25.Whether a string is successfully normalized to various normalization forms.