Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of 'var' in C#
Message
From
30/04/2010 17:18:00
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01462533
Message ID:
01462596
Views:
73
>What's the benefit of
>
>
>var customer = new Customer();
>
>
>as opposed to
>
>
>Customer customer = new Customer();
>
Most of the time the type can be inferred from the right side. In those cases var is a keyword meaning the inferred type. One big advantage is that if sometimes you are unsure about the type (but it can be inferred) then you use "var" then hover your cursor on var to see the inferred type. You are free to type the type yourself or let it be inferred.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform