andrewducker: (running with fire)
[personal profile] andrewducker
God, I wish we had the latest version of Visual Studio at work.

I spent the morning playing with C# code after reading this article on brevity in code.

Trying to find something that I preferred over the Ruby code that did this:
“”.methods.sort.grep /index/i

and eventuall ending up with:
from methodName in "".MethodNames() 
  where methodName.Grep("index",RegexOptions.IgnoreCase) 
  orderby methodName select methodName;

The main thing that would be nice would be a simple sort keyword that could be used if only one variable was being operated on, and likewise not needing a select if there's only one item being dealt with.

Date: 2010-03-20 04:40 pm (UTC)
From: [identity profile] odheirre.livejournal.com
Can you use lambda syntax to do that and skip the select?

"".MethodNames().Where(m => m.Grep("index", RegexOptions.IgnoreCase)).OrderBy(m => m);

Date: 2010-03-20 05:09 pm (UTC)
From: [identity profile] momentsmusicaux.livejournal.com
> PHP because it’s just Even Uglier Perl

Haha. Yes.

Date: 2010-03-21 11:09 am (UTC)
From: [identity profile] channelpenguin.livejournal.com
whe you get what you are happy with then wrap it in a method in some common library and it's as neat as you like :-).

maybe I miss the point :-)

March 2026

S M T W T F S
1 2 3 4 56 7
8 9 10 11 12 13 14
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 15th, 2026 06:46 am
Powered by Dreamwidth Studios