Syntactically closely related to arithmetic operations is string concatenation, reusing the + operator notation. The following is an example:
Console.Write("Enter your name: ");string name = Console.ReadLine();string message = "Hello " + name;Console.WriteLine(message);
The way concatenation works internally is by calling into any of the
String.Concat static methods, as shown in Figure 5.17.
Figure 5.17. String concatenation under the hood.
String concatenation is available not only between two string types but also between a string and any object (
System.Object). In that case,
ToString is invoked on the object before carrying ...