C# Data Types and Variables
In this lesson, we look at how different types of data are stored using variables within a C# program. C# is a strongly typed language, meaning when you manipulate data in code, you must keep the data in variables that are specifically designed to hold that kind of data. For example, text is stored in a string data type and a letter in a char. There are over ten different numeric data types that vary in size and accuracy or precision of the data they can faithfully represent. We investigate some of the quirks in dealing with fractional numbers in a computer's binary environment. There are in-depth code examples for each of these topics to illustrate the discussed concepts and make you more familiar with C# programming in general.
This lesson builds upon the key concepts and examples covered in the Introduction to C# lesson. It includes guided demonstrations to give you practical knowledge of how to handle the concepts covered.
Learning Objectives
- Understand what variables are and how they're stored
- Learn about data types for storing and manipulating text values
- Learn about the various data types for storing and manipulating whole and fractional numbers
- Learn about variables for storing multiple values of the same data type
Intended Audience
This lesson is intended for anyone who has a basic understanding of C# and now wants to build upon that knowledge.
Prerequisites
This lesson carries on from our Introduction to C# lesson, so we suggest taking that one first if you haven't already done so.
Resources
Code examples used in demos on GitHub: https://github.com/cloudacademy/csharp-datatypes-variables