Use the Concat() method to concatenate strings : String : String C# Examples


C# Examples » String » String »

 

Use the Concat() method to concatenate strings









    
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);
    }

}
    
   
  
   



Output

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


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» String