Introduction

Completed

As a software developer, you'll need to write C# code to combine and format literal and variable data to create a new value. That value might be displayed, saved to file, or sent across the network. Fortunately, C# provides many ways to combine and format data.

Suppose you want to display the output of a command-line application you're writing. You want to display values including literal text, text in variables, numeric data, and textual data in other languages. How would you format it correctly so that the user can understand what your application is communicating to them?

In this module, you'll use character escape sequences to format literal strings of text to include special characters including tabs and line feeds — even characters from different languages like Kanji or Cyrillic script! You'll learn how to concatenate two strings together and will use string interpolation to create a literal string template with replaceable parts.

By the end of this module, you'll be able to control how your data is displayed to end users of your applications.

Learning objectives

In this module, you will:

  • Create string data containing tabs, new lines, and other special characters
  • Create string data containing Unicode characters
  • Combine string data into a new string value via concatenation
  • Combine string data into a new string value via interpolation

Prerequisites

  • Beginner level experience with a .NET editor
  • Beginner level experience with displaying a message to a console using the Console.WriteLine() and Console.Write(String) methods.
  • Beginner level experience with data types, declaring, initializing, setting, and retrieving values from variables.