Skip to Content
Learning C# 3.0
book

Learning C# 3.0

by Jesse Liberty, Brian MacDonald
November 2008
Beginner
696 pages
17h 43m
English
O'Reilly Media, Inc.
Content preview from Learning C# 3.0

Types

C# is a strongly typed language. That means that every object you create or use in a C# program must have a specific type. In other words, you must declare the object to be an integer or a string or a Dog or a Button. Essentially, the type indicates the characteristics of the object and what it can do.

Types come in two flavors: those that are built into the language (intrinsic types) and those you create yourself (classes and interfaces, discussed in Chapters Chapter 7 and Chapter 13). C# offers a number of intrinsic types, shown in Table 3-1.

Table 3-1. The intrinsic types built into C#

C# type

Size (in bytes)

.NET type

Description

byte

1

Byte

Unsigned (values between 0 and 255).

char

2

Char

Unicode characters (a modern way of storing most characters, including international language characters).

bool

1

Boolean

True or false.

sbyte

1

SByte

Signed (values between –128 and 127).

short

2

Int16

Signed (short) (values between –32,768 and 32,767).

ushort

2

UInt16

Unsigned (short) (values between 0 and 65,535).

int

4

Int32

Signed integer values between –2,147,483,648 and 2,147,483,647.

uint

4

UInt32

Unsigned integer values between 0 and 4,294,967,295.

float

4

Single

Floating-point number. Holds the values from approximately +/-1.5 x 10-45 to approximately +/-3.4 x 1038 with seven significant figures.

double

8

Double

Double-precision floating-point. Holds the values from approximately +/-5.0 x 10-324 to approximately +/-1.8 x 10308 with 15 to 16 significant figures.

decimal

12

Decimal

Fixed-precision up to 28 digits and the position ...

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# 3.0 Design Patterns

C# 3.0 Design Patterns

Judith Bishop
Windows Runtime via C#

Windows Runtime via C#

Jeffrey Richter and Maarten van de Bospoort
C# 7.0 in a Nutshell

C# 7.0 in a Nutshell

Joseph Albahari, Ben Albahari

Publisher Resources

ISBN: 9780596155018Errata Page