
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Operators, Types and Variables in C#
Variables in C#
A variable is a name given to a storage area that our programs can manipulate. Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.
Types in C#
The variables in C#, are categorized into the following types: Value, Reference and Pointer types.
Value types
Value type variables can be assigned a value directly. They are derived from the class system.ValueType.
Reference types
The reference types do not contain the actual data stored in a variable, but they contain a reference to the variables.
Using multiple variables, the reference types can refer to a memory location. If the data in the memory location is changed by one of the variables, the other variable automatically reflects this change in value. Example of built-in reference types are: object, dynamic, and string.
Pointer types
Pointer type variables store the memory address of another type.
Operators in C#
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
The following are the operators −
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment Operators
- Related Articles
- What are variables and types of variables in C++?
- Variables, their types, and Scope in C++
- Different types of operators in C++
- Java variables and data types
- # and ## Operators in C ?
- Equality Operators: == and != in C++
- What are different Identity operators types in Python?
- What are different assignment operators types in Python?
- What are different bitwise operators types in Python?
- What types of logical operators are in javascript?
- Relational and comparison operators in C++
- Increment ++ and decrement -- Operators in C++
- Increment and Decrement Operators in C#
- Relational and Logical Operators in C
- What are local variables and global variables in C++?
