Demonstrating string class Concat method. - CSharp Language Basics

CSharp examples for Language Basics:string

Description

Demonstrating string class Concat method.

Demo Code



using System;/*from w  w  w .  j ava 2  s .c om*/

class StringConcatenation
{
   static void Main()
   {
      var string1 = "Happy ";
      var string2 = "Birthday";

      Console.WriteLine($"string1 = \"{string1}\"");
      Console.WriteLine($"string2 = \"{string2}\"");
      Console.WriteLine("\nResult of string.Concat(string1, string2) = " + string.Concat(string1, string2));
      Console.WriteLine($"string1 after concatenation = {string1}");
   }
}

Result


Related Tutorials