DotNetKick.com is an open-source project. Please report any bugs and let us know your great suggestions. Currently running svn revision 620 (rss)

Kick Spy!, Kick Zeitgeist and Kick Widgets

28
kicks
published 3 months, 2 days ago, submitted by mcintyre321 3 months, 2 days ago

adverseconditionals.com — Just another silly extension method hack :)

Add a comment 11 comments | category: | Views: 908 | Get KickIt image code
tags: | tag it

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:
"Do you like reducing your line count at the expense of readability to others?"

Personally no. I think that the readability of code is rather important, especially in a team environment where you may need to read & understand someone else's code. Even on a personal project I still think readability is important, how many times have you done some clever/cool coding then come back to it months later and just gone WTF?!?
posted by Tr3v 3 months, 2 days ago
Dunno. Its pretty clear what he's doing. I mean, the method name is "Catch" and he's got a NRE in the lambda.... The only sore point is figuring out what he's using the lambda for.
posted by yesthatmcgurk yesthatmcgurk 3 months, 2 days ago
Yes that is indeed true, however my comment was aimed at the question rather than the example.
posted by Tr3v 3 months, 2 days ago
@Tr3v, I think the comment was kind of tongue-in-cheek. FWIW, I found the code still quite readable.
posted by JudahGabriel JudahGabriel 3 months, 2 days ago
Not bad. Condenses 5 lines of actual code down to one. Perfect for shrinking tiny little bits.
posted by spoulson 3 months, 2 days ago
And where do you place a breakpoint so you can step through this? I see absolutely no value in placing 6 steps of execution onto a single line of code. Are we trying to save on disc storage? Are we you trying to fit more code onto our 19 inch screens? I do not thing lambdas have been around long enough for this to be considered readable. Developers know the try...catch coding style and are comfortable with it. This in no way is more efficient code when it comes to the runtime. Either way it will unfold it into the same set of CLR instructions so you gain nothing by reducing 6 lines of code to 1.
posted by offwhite offwhite 3 months, 2 days ago
If there are 2 projects that are EQUAL IN READABILITY.... <- caps lock

I would rather debug the one with less code.
posted by software.developer 3 months, 2 days ago
@spoulson "perfect for shrinking [my] tiny little bits" lol

@offwhite, actually, since you're introducing a new Function delegate here, you're actually allocating a new object. This will result in more IL instructions, more memory usage. (Unless of course the JITer or compiler can optimize it away.)
posted by JudahGabriel JudahGabriel 3 months, 2 days ago
I wouldn't use that in a project with a team consisting of more than myself.
posted by gt1329a gt1329a 3 months, 2 days ago
I'm just glad none of you have pointed out that you can write on a single line already :)
int y; try { y = DoSomething(); }catch (NullReferenceException ex){ y = -1;}
posted by mcintyre321 3 months, 1 day ago
I like it, but wouldn't use it :)
posted by samdnp 3 months, 1 day ago



information Login or create an account to comment on this story
 

Sponsored Link: www.carlist.ie

Search:

Ads via The Lounge