0

What is var

2nd Nov 2016, 3:40 PM
Riyaz Ahmed
Riyaz Ahmed - avatar
3 Answers
+ 1
var is short for variable. C# can automatically infer the data type for you when you use var. Therefore, you can type: int numberTwo = 2 or var numberTwo = 2. The C# compiler can infer that var numberTwo = 2 is of type int.
2nd Nov 2016, 6:18 PM
Benjamin McKissick Jr.
Benjamin McKissick Jr.   - avatar
0
It's variable that you can create. Variable is basically container for storing informations.
2nd Nov 2016, 4:33 PM
Nemanja Simović
Nemanja Simović - avatar
0
var is dynamic datatype it will hold any type of variable. for ex. var number=1; or var number="one";
7th Nov 2016, 5:20 PM
Harish Sune
Harish Sune - avatar