The course is part of this learning path
In this course, 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 course builds upon the key concepts and examples covered in the Introduction to C# course. It includes guided demonstrations to give you practical knowledge of how to handle the concepts covered.
- 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
This course is intended for anyone who has a basic understanding of C# and now wants to build upon that knowledge.
This course carries on from our Introduction to C# course, so we suggest taking that one first if you haven't already done so.
Code examples used in demos on GitHub: https://github.com/cloudacademy/csharp-datatypes-variables
I'll go back to the hellomars code from the introductory course and change the color scheme to light, so it's easier to see my notes. We're going to cover two main topics, data types and variables, in this course. Data types and variables are very closely related and are a fundamental pillar of programming.
We'll start with some background theory, and then see how that translates to practical coding. It doesn't matter whether you're using Windows, macOS, Linux, Visual Studio, or VSCode. All I'll talk about and demonstrate will be more or less identical no matter the platform, and any differences I'll point out.
Just to recap where we left off from the introductory course, we created a simple console application that took in one argument. The argument is assigned to a string variable called myName, and then myName is appended to some literal text and written to the console. When I ran the program using "Elon" as the argument, this is what it produced. "Hello Mars! from Elon." I'll be referring back to this code as we talk about variables and data types.
Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard.