OJ's rants

It's not about you, it's about the software

WTF: You'll Never Amount to Anything

| Comments

Yes, it just gets better and better! This beauty is just a few of the lines that make up a huge “property get” in C#. Count the WTFs in this crazy baby:

1
2
3
4
5
6
7
8
9
10
11
12
13
string amount = "";
double Amount = 0;
try
{
  amount = (string)r["Amount"];
  Amount = Convert.ToDouble(amount);
}
catch
{
  // use formula rather than value
  AmountFormula = amount;
  Amount = 0;
}

If I had a prize, I’d give one away, but I don’t. So instead, you’ll have to settle for kudos. How many can you find?

WTFness: 9 / 10.

Comments