 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to declare variables in C#?
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.
To declare variables −
<data_type> <variable_list>;
Let us see an example to declare two integer variables −
int a, b;
Above the variable is of int type. Let us declare a variable for other types −
Variable of float type.
float f;
Variable of double type.
double d;
Let us display a variable −
Example
using System; using System.Collections; class Demo {    static void Main() {       int x = 50;       Console.WriteLine("Integer variable:"+x);    } }  Output
Integer variable:50
Advertisements
 