Home
Tool
Json Beautify
Find Web URL
Inventory Management System
Test Mantra RD Service
Calculate your EMI
Project
Inventory Management System
Task Management
Project Management
Mobile Store Management
Money Transfer Tool
Store Management
About Us
Contact
Login
Registration
Search
ASP.net,C-Sharp,MVC,WCF,WPF
C# Data Types
By
Csharp Code
Apr 29 2020
1179 View's
0 Comment's
Like (
0
)
Dislike (
0
)
As explained in the variables chapter, a variable in C# must be a specified data type
int myNum = 5; // Integer (whole number)
double myDoubleNum = 5.99D; // Floating point number
char myLetter = 'D'; // Character
bool myBool = true; // Boolean
string myText = "Hello"; // String
A data type specifies the size and type of variable values. It is important to use the correct data type for the corresponding variable; to avoid errors, to save time and memory, but it will also make your code more maintainable and readable. The most common data types are
Data Type
Size
Description
int
4 bytes
Stores whole numbers from -2,147,483,648 to 2,147,483,647
long
8 bytes
Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float
4 bytes
Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits
double
8 bytes
Stores fractional numbers. Sufficient for storing 15 decimal digits
bool
1 bit
Stores true or false values
char
2 bytes
Stores a single character/letter, surrounded by single quotes
string
2 bytes per character
Stores a sequence of characters, surrounded by double quotes
0 Comment's
Comment Form
Submit Comment
Csharp Code
If opportunity doesn’t knock, build a door.⛩
Popular Post
WPF
How to Use Logger in WPF Application
By
Csharp Code
Jun 07 2022
C-Sharp
Update Specific Users Out of Oce Settings C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Retrieve Specified User''s Out of O ce Settings C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Large Object Heap compaction C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Weak References C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Source code in the view C# with Example
By
Csharp Code
Jun 06 2022
Notifications