Chapter 4. Types and References: It’s 10:00. Do you know where your data is?

Data type, database, Lieutenant Commander Data... it’s all important stuff. Without data, your programs are useless. You need information from your users, and you use that to look up or produce new information to give back to them. In fact, almost everything you do in programming involves working with data in one way or another. In this chapter, you’ll learn the ins and outs of C#’s data types, see how to work with data in your program, and even figure out a few dirty secrets about objects (pssst...objects are data, too).
The variable’s type determines what kind of data it can store

There are a bunch of types built into C#, and each one stores a different kind of data. You’ve already seen some of the most common ones, and you know how to use them. But there are a few that you haven’t seen, and they can really come in handy, too.
Types you’ll use all the time
It shouldn’t come as a surprise that int, string, bool, and double are the most common types.
intcan store any whole number from –2,147,483,648 to 2,147,483,647.Note
A whole number doesn’t have a decimal point.
stringcan hold text of any length (including the empty string"").boolis a Boolean value—it’s eithertrueorfalse.doublecan store real numbers from ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access