In C#, string concatenation can be done using the + operator or the string.Concat method. Here’s how to use both:
Using the + operator:
string str1 = "Hello";
string str2 = "world";
string result = str1 + " " + str2;
Console.WriteLine(result); // Output: "Hello world"
Using the string.Concat method:
string str1 = "Hello";
string str2 = "world";
string result = string.Concat(str1, " ", str2);
Console.WriteLine(result); // Output: "Hello world"
Learners TV is a website that is designed to educate users and provide instructional material on particular subjects and topics.