Introduction

Completed

The C# programming language relies on data types extensively. Data types restrict the kinds of values that can be stored in a given variable, which can be helpful when trying to create error free code. As a developer, you confidently perform operations on your variables because you know in advance that it only stores valid values.

Suppose your job is to build a new application that must retrieve, manipulate, and store many different kinds of data, including individual numeric values and sequences of numeric and text values. Choosing the right data types is critical to the success of your software development efforts. But what are your options, and what criteria should you use when faced with several data types that seem similar?

In this module, you learn how your application stores and processes data. You learn that there are two kinds of data types that correspond with the two ways that data is processed. You write code that identifies the maximum and minimum values that can be stored in a particular numeric data type. And, you learn the criteria to use when choosing between several numeric data types for your application.

By the end of this module, you'll be confident when working with different data types in C# and able to choose the right data type for your particular application.

Learning objectives

In this module, you will:

  • Learn the fundamental differences between value types and reference types.
  • Describe the properties of many new numeric data types, including new integral types and floating point types.
  • Write code that returns the maximum and minimum values that numeric data types can store.
  • Use the new keyword to create new instances of a reference type.
  • Determine which data type you should choose for a given application.

Prerequisites

  • Experience using basic data types like string, char, bool, int, and decimal
  • Experience using string interpolation to combine variables in string templates
  • Experience using code comments to comment out unused code
  • Experience using Visual Studio Code to develop, build, and run C# code