How to append strings in C#

2 Answers

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "c# ";

            s += "java ";
            s += "c++";

            Console.WriteLine(s);
        }
    }
}

/*
run:
   
c# java c++
 
*/

 



answered Jan 16, 2017 by avibootz
0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = "c# ";
            string s2 = "java ";
            string s3 = "c++ ";

            s1 += s2 + s3;

            Console.WriteLine(s1);
        }
    }
}

/*
run:
   
c# java c++
 
*/

 



answered Jan 16, 2017 by avibootz

Related questions

1 answer 179 views
1 answer 173 views
173 views asked Jan 16, 2017 by avibootz
1 answer 188 views
1 answer 170 views
4 answers 175 views
175 views asked Oct 18, 2023 by avibootz
1 answer 129 views
...