In an IM conversation at work I was asked “How many lines of C# do you reckon to change the position of a record [in a GridView]?”.
I didn’t know the punch line for that one (turns out is was a legitimate question :-) ), but offered what I believe may be the worst programming joke ever:
“A delegate walks into a function and offers a few pointers. :-)”
Thanks, I’ll be here all week. Try the veal! [insert sound of crickets chirping] Well, it’s kind of funny, in much the same way as an unadorned filing cabinet is funny. [more crickets]
In terms of the original question, the answer was 114 with duplicated methods to move the record up and down the GridView (methods differing only by the +/- in front of a 1). Um, the code was not a shining beacon of terseness, best-practice or reusability. I think it is currently being rewritten in about 5 lines.