Skip to Content
C# 6.0 Cookbook, 4th Edition
book

C# 6.0 Cookbook, 4th Edition

by Stephen Teilhet, Jay Hilyard
October 2015
Intermediate to advanced
600 pages
16h 32m
English
O'Reilly Media, Inc.
Content preview from C# 6.0 Cookbook, 4th Edition

Chapter 3. Data Types

3.0 Introduction

Simple types are value types that are a subset of the built-in types in C#, although, in fact, the types are defined as part of the .NET Framework Class Library (.NET FCL). Simple types are made up of several numeric types and a bool type. Numeric types consist of a decimal type (decimal), nine integral types (byte, char, int, long, sbyte, short, uint, ulong, and ushort), and two floating-point types (float and double). Table 3-1 lists the simple types and their fully qualified names in the .NET Framework.

Table 3-1. The simple data types
Fully qualified name Alias Value range
System.Boolean bool true or false
System.Byte byte 0 to 255
System.SByte sbyte -128 to 127
System.Char char 0 to 65535
System.Decimal decimal -79,228,162,514,264,337,593,543,950,335 to 79,228,162,514,264,337,593,543,950,335
System.Double double -1.79769313486232e308 to 1.79769313486232e308
System.Single float -3.40282347E+38 to 3.40282347E+38
System.Int16 short -32768 to 32767
System.Uint16 ushort 0 to 65535
System.Int32 int -2,147,483,648 to 2,147,483,647
System.UInt32 uint 0 to 4,294,967,295
System.Int64 long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
System.UInt64 ulong 0 to 18,446,744,073,709,551,615

When you are dealing with floating-point data types, precision can be more important than the range of the data values. The precision of the floating-point data types is listed in Table 3-2.

Table 3-2. Floating-point ...
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

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

C# 8 and .NET Core 3.1 Recipes (2nd Edition) - Second Edition

C# 8 and .NET Core 3.1 Recipes (2nd Edition) - Second Edition

Dimitiris Loukas
C# 7 and .NET Core Cookbook - Second Edition

C# 7 and .NET Core Cookbook - Second Edition

Fabio Claudio Ferracchiati, Dirk Strauss
C# 4.0 in a Nutshell, 4th Edition

C# 4.0 in a Nutshell, 4th Edition

Joseph Albahari, Ben Albahari
C# 5.0 Unleashed

C# 5.0 Unleashed

Bart De Smet

Publisher Resources

ISBN: 9781491921456Errata Page