WTF: You’ll Never Amount to Anything

Wednesday December 20thWTF Category

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:
[source:csharp]string amount = “”;
double Amount = 0;
try
{
amount = (string)r["Amount"];
Amount = Convert.ToDouble(amount);
}
catch
{
// use formula rather than value
AmountFormula = amount;
Amount = 0;
}[/source]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.

1 Comments

  1. Keef
    January 3, 2007

    I can’t even work out what the intended function of that code is. It’s utterly baffling.

Leave a comment

Size

Colors