String Manipulation Concatenate


   

/*
Learning C# 
by Jesse Liberty

Publisher: O'Reilly 
ISBN: 0596003765
*/
 using System;

 namespace StringManipulation
 {
    public class TesterStringManipulationConcat
    {
       public void Run()
       {
           string s1 = "abcd";
           string s2 = "ABCD";

           // concatenation method
           string s3 = string.Concat(s1,s2);
           Console.WriteLine(
               "s3 concatenated from s1 and s2: {0}", s3);

           // use the overloaded operator
           string s4 = s1 + s2;
           Console.WriteLine(
               "s4 concatenated from s1 + s2: {0}", s4);

       }

       static void Main()
       {
          TesterStringManipulationConcat t = new TesterStringManipulationConcat();
          t.Run();
       }
    }
 }

           
          


This entry was posted in Data Types. Bookmark the permalink.