My UnWordify Extension Method
Tim Barcz is looking for a solution to an interesting problem in his Coding Contest: Create a Programming Pearl post. I decided to challenge myself by writing my solution as a single “line” of code:...
View ArticleSplitting CamelCase With Regular Expressions
On my new project, I needed to split a method name up into its constituent parts. For Ruby programmers, this is easy: just split on underscores. For us .NET programmers, we need something a little...
View ArticleRogueSharp
I just pushed a pet project of mine up to GitHub today. It’s a port of the original game of Rogue from C to C#. It’s not complete–it doesn’t save your progress and let you continue on later, but it is...
View ArticleOne-line lazy initialization
Is this too obscure? public class MyObject { private MyExpensiveObject _myExpensiveObject; public MyExpensiveObject ExpensiveObject { get { return _myExpensiveObject ?? (_myExpensiveObject = new...
View ArticleWhy won’t my iterator throw?
I ran into a spot of confusion last night doing some TDD on a method that returns an IEnumerable<T>. I was using multiple yield return statements in it which made the method an iterator and not...
View Article