Implicitly Typed Local Variables (www.iansuttle.com)

submitted by isuttleisuttle(1140) 2 years, 6 months ago

C# 3.0 introduces implicitly typed local variables by way of the keyword “var”. The use of var allows one to assign a number of different types to a variable without explicitly stating that variable’s type. Var is actually not a type at all, but a keyword which instructs the compiler to infer the most appropriate type based on the value or expression to the right of the equals sign.

2 comments | category: | Views: 2

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:

Comments:

posted by yesthatmcgurkyesthatmcgurk(3805) 2 years, 6 months ago

Lots of lazy ass programmers are going to be loading their code with var's. I can hardly wait until I have to use a framework with something like this in it:
LazyObject.PerformSomeFunction(var zzz);

posted by isuttleisuttle(1140) 2 years, 5 months ago

Lol - I do agree there's a risk of that as noted in the article. Luckily VS maintains knowledge of the underlying type, but readability would certainly be degraded.

information Login or create an account to comment on this story