- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the operator that concatenates two or more string objects in C#?
Use operator + to concatenate two or more string objects.
Set the first string object.
char[] c1 = { 'H', 'e', 'n', 'r', 'y' }; string str1 = new string(c1);
Now, set the second string object.
char[] c2 = { 'J', 'a', 'c', 'k' }; string str2 = new string(c2);
Now display the concatenated strings using + operator.
Example
using System.Text; using System; class Program { static void Main() { char[] c1 = { 'H', 'e', 'n', 'r', 'y' }; string str1 = new string(c1); char[] c2 = { 'J', 'a', 'c', 'k' }; string str2 = new string(c2); Console.WriteLine("Welcome " + str1 + " and " + str2 + "!"); } }
Output
Welcome Henry and Jack!
Advertisements
To Continue Learning Please Login
Login with Google