0% found this document useful (0 votes)
36 views

Primitive Data Types: Complete C# Masterclass by Denis Panjuta

The document discusses the different primitive data types in C#: 1) Integral types include sbyte, short, integer, and long with varying value ranges for storing whole numbers. 2) Floating point types are float, double, and decimal for storing fractional values, with each having different precision levels and value ranges. 3) Boolean type bool is used to represent true or false values. 4) Characters and strings use char for single characters and string for text, suitable for names, paths, and other text data.

Uploaded by

Bace Andrei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Primitive Data Types: Complete C# Masterclass by Denis Panjuta

The document discusses the different primitive data types in C#: 1) Integral types include sbyte, short, integer, and long with varying value ranges for storing whole numbers. 2) Floating point types are float, double, and decimal for storing fractional values, with each having different precision levels and value ranges. 3) Boolean type bool is used to represent true or false values. 4) Characters and strings use char for single characters and string for text, suitable for names, paths, and other text data.

Uploaded by

Bace Andrei
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Primitive data types

Complete C# Masterclass by Denis Panjuta

Integral
sbyte ​x = 1; ​range from -128 - 127
short ​x = 1; ​range from -32,768 - 32,767
integer ​x = 1; ​range from -2,147,483,648 - 2,147,483,647
long ​x = 1; ​range from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Choose the smallest type your value fits into.

Floating point
float ​x = 0.5f; ​range from 1.5 × 10^−45 - 3.4 × 10^38, ​7-digit precision
double ​x = 0.5; ​range from 5.0 × 10^−324 - 1.7 × 10^308, ​15-digit precision
decimal ​x = 0.5m; ​range from –7.9 × 10^−28 - 7.9 × 10^28, ​28-digit precision

Use ​float​ for 3D graphics, ​double​ for everything (except money calculations) and ​decimal​ ​for
financial applications.

Boolean
bool​ ​switch = true;

Use a boolean if you want to set something to true or false (just like a toggle).

Unicode characters and strings


char ​c = ‘A’;
string ​name = “John Doe”;

Use a string for a path, username, birthdate...

You might also like