1. What Are Variables? (Simple Definition)
A variable is like a container in memory that stores data.
Think of it like:
A water bottle (container) = variable
The water inside = value
The type of water (500ml, 1 liter) = data type
C# Definition
A variable in C# is a named storage location in memory used to store a value.
It has:
Name
Data Type
Value
Syntax
dataType variableName = value;
Example
int age = 25;
string name = "Sandhiya";
double price = 99.50;
Real-Time Example (Easy Explanation)
Imagine you are building a shopping website:
| Variable Name | Data Type | Purpose |
|---|---|---|
| productName | string | Store the product name |
| productPrice | double | Store the price |
| stockCount | int | How many items available |
string productName = "Laptop";
double productPrice = 59999.99;
int stockCount = 10;
2. What Are Data Types?
A data type tells the compiler what type of data a variable will store.
C# Data Types Categories
1. Value Types (store data directly)
int
double
float
char
bool
2. Reference Types (store memory address)
string
arrays
class objects
Common Data Types with Examples
Below are all commonly used data types with simple, real-time examples.
1. int (Integer)
Stores whole numbers (no decimal).
int age = 25;
int stock = 100;
Real-time: Number of items in cart, number of login attempts.

Join the conversation! Your thoughts help the community grow.