How to Add Multiple Values to String in C#

How to Add Multiple Values to String in C#. In this program, we can merge multiple string values in the output. The process of combining two sets of data into one. The output data may be in their original order or reordered according to the key field or some other attribute.

using System;

namespace Main
{
class Program
{
static void Main(string[] args)
{
string text1 = "Welcome to ";
string text2 = "Inlarn";
string fulltext = text1 + text2;
Console.WriteLine(fulltext);
}
}
}

 

Output:

Welcome to Inlarn

String in C# Program

An object with text as its value is a string. The text is stored in a sequential read-only collection of Char objects. C# strings have no null-terminating character, so any number of null characters (“0”) can be inserted into them. 

Anything in the string that would normally be interpreted as an escape sequence is ignored as a result of this behaviour. Unless you want to use an escape sequence to remove the double quote, there’s no way around this. There must be a double quote between each pair of double quotes.

Namespace in C#

Namespace is a C++ feature that is not available in C. A namespace is a declarative region that gives identifiers for types, functions, and variables within it a scope. It is permissible to have multiple namespace blocks with the same name. The named scope is used for all declarations within those blocks. 

The classes are organised using namespaces. The most significant benefit of using namespace is that class names declared in one namespace do not conflict with class names declared in another namespace.