Lesson contents

Working with strings

Join two pieces of text in the order you want them to appear.

Simple example

Join two letters.

StartA + B
ResultAB
Program.cs
using System;

string line = "A" + "B";
Console.WriteLine(line);
Output
AB
Advertisements

Everyday examples

A shelf label starts with the aisle letter and ends with the shelf number. Make the label for shelf 12 in aisle C.

StartC + 12
ResultC12
Program.cs
using System;

string line = "C" + "12";
Console.WriteLine(line);
Output
C12
Run the example
Terminal
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson
Official documentation