Choose the correct data type in your C# code

Beginner
Developer
Higher Education Educator
K-12 Educator
Student
.NET
Visual Studio Code

Learn the difference between many data types, how they work, what they do, and how to choose one over another.

Learning objectives

  • 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.