SomeValue
singh iz king
Posts
-
Friday programming quiz -
!(How to best use a try catch block) [modified]Yes, That is one of the ways I suggested, but also added that if you are calculating an average, then the name should probably reflect that as well :)
-
!(How to best use a try catch block) [modified]Lol...good one Unfortunately, I've come across so many such instances of bad programmers in my career (and I'm sure most of you have as well). This fortunately for me has been the only instance where the developer has understood what they've done wrong and positively taken on board the recommendations I've made. I actually came across this while doing a code review for a team that I had not worked with before.
-
!(How to best use a try catch block) [modified]Hi Thomas, Thanks for that. The day I came across this, I had a private discussion with the developer and reasoned the right way of doing this. The message seems to be slowly getting across :)
-
!(How to best use a try catch block) [modified]Yup...rightly picked up. I forgot to include the get block :doh:
-
!(How to best use a try catch block) [modified]Just came across a class which has tens of such properties. These properties are called by other classes and by other properties / methods of this class!!! Oh! and also look how the property name says total, but is actually returning an average :omg:
public double CrappyTotal
{
double CrappyTotal = 0; // notice the name of the variable is the same as the property
try
{
CrappyTotal = this.SomeItem.Details[0].Value;
CrappyTotal += this.SomeItem.Details[1].Value;
CrappyTotal += this.SomeItem.Details[2].Value;
CrappyTotal += this.SomeItem.Details[3].Value;
CrappyTotal = CrappyTotal / 4;
}
catch
{
CrappyTotal = -1;
}
return CrappyTotal;
}modified on Wednesday, July 8, 2009 11:35 PM
-
LINQ gotcha I ran intoWhat about ?
var finished = ordered.Where(n => n != 0).Concat(ordered.Where(n => n == 0))
What is the benefit of using SkipWhile and TakeWhile over just using the Where clause?
-
Good if paid by number of lines!this seems to be one of the most common horrors' posted here and also one of the most common I come across...