The Daily WTF
At an old job, I did a significant amount of VB.Net work. I didn’t hate VB.Net. Sure, the syntax was clunky, but autocomplete mostly solved that, and it was more OR
less feature-matched to C# (and, as someone who needed to handle XML, the fact that VB.Net had XML literals was handy).
Every major feature in C# had a VB.Net equivalent, including lambdas. And hey, lambdas are great! What a wonderful way to express a filter condition.
Well, Eric O sends us this filter lambda. Originally sent to us as a single line, I’m adding line breaks for readability, because I care about this more than the original developer did.
Function(row, index) index <> 0 AND (row(0).ToString().Equals(“DIV10106”) OR row(0).ToString().Equals(“326570”) OR row(0).ToString().Equals(“301100”) OR row(0).ToString().Equals(“305622”) OR row(0).ToString().Equals(“305623”) OR row(0).ToString().Equals(“317017”) OR row(0).ToString().Equals(“323487”) OR row(0).ToString().Equals(“323488”) OR row(0).ToString().Equals(“324044”) OR row(0).ToString().Equals(“317016”) OR row(0).ToString().Equals(“316875”) OR row(0).ToString().Equals(“323976”) OR row(0).ToString().Equals(“324813”) OR row(0).ToString().Equals(“147000”) OR row(0).ToString().Equals(“326984”) OR row(0).ToString().Equals(“326634”) OR row(0).ToString().Equals(“306039”)
To read the full article click on the 'post' link at the top.