Playing with code
Mar. 20th, 2010 02:21 pmGod, 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:
and eventuall ending up with:
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.
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.
no subject
Date: 2010-03-20 04:40 pm (UTC)"".MethodNames().Where(m => m.Grep("index", RegexOptions.IgnoreCase)).OrderBy(m => m);
no subject
Date: 2010-03-20 04:43 pm (UTC)no subject
Date: 2010-03-20 04:54 pm (UTC)no subject
Date: 2010-03-20 05:09 pm (UTC)Haha. Yes.
no subject
Date: 2010-03-21 11:09 am (UTC)maybe I miss the point :-)
no subject
Date: 2010-03-21 11:11 am (UTC)I have to agree that the Java example he gave is ridiculous for "get a list of methods, sort them and filter them". I'm glad C# makes it a lot easier.