Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Afzaal Ahmad ZeeshanRank #60 · 27.6K reputationPosted Mar 15, 2015, 5:57 AM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 15, 2015, 8:12 PM EDT
Hi,
This is not necessary.....
The var keyword was introduced in C# 3.0. It is an implicit type and the type is determined by the C# compiler. There is no performance penalty when using var. The C# compiler assigns types to the variable when it assigns the value.
It makes programs shorter and easier to read. In short the var keyword is an implicit way of defining data types. It is an indirect way of defining the variable type. The "var" keyword defines the data type statically (at compile time) and not at runtime.
also some time we use it with LINQ and anonymous types that help us reduce the code (reduce effort to create a new class).
hope this will help you.
Sakthikumar ThanavelRank #1,235 · 1.4K reputationPosted Jun 24, 2015, 11:21 AM EDT
Isha Malhotra37 reputationPosted Jul 9, 2015, 9:47 PM EDT
Govinda Rajulu YemineniRank #1,517 · 1K reputationPosted Jul 17, 2015, 9:23 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Jul 17, 2015, 9:38 PM EDT
Manoj BhoirRank #599 · 4K reputationPosted Jul 17, 2015, 9:53 PM EDT
Neha Admec21 reputationPosted Feb 5, 2022, 2:56 AM EST