In my first four college classes on object oriented programming, every assignment had us prompting the user for input from the command line. After the third assignment, I figured out this shortcut, and aced every assignment after that.
With this great power comes my great responsibility to share it with those who will come after me.
Grapevine is .NET 4.0 class library I wrote in C# to provide my applications with an easy way to include a REST server without a dependency on ASP.NET. While I was at it, I made it a simple HTTP server at the same time. And added the ability to be a REST client, too. All that, in one simple class library.
I have plans to do an entire series of articles on the sheer awesomeness that is my native tongue (Perl). I envision whole sections dedicated to setting up your environment, tips for beginners and intermediates alike, and maybe an advanced topic or two. At that point, this blog post will firmly fall under the category of “Appendix“.
Nevertheless, this information was hard earned and will save me lots of time, so I wanted to share in the blessed bliss.
I know, it doesn’t quite roll off the tongue like the old black-and-white TV show title.
As early as Visual Studio2008, C# has provided a special kind of static method called extension methods. We can use these extension methods to extend a class or interface, but not override it. This provides the ability to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.
Extending Enum in C# Using Custom Attributes and Methods
I love enumerations. Simple, consistent and – in OO languages like Java and C# – enforced by the IDE. But I know I’m not the only one who has lamented over the apparent inability to extend the Enum data type in C#. If you stumbled upon this post, you’ve probably had the same problem.
Keep reading to see what I did to alleviate this shortcoming.
I found this to be the perfect opportunity to capture the apocryphal Six Stages of Debugging in the expressions of the ever intrepid Jim Halpert (with a few other pop-culture references sprinkled in the links).