One of the things I like about ruby is that you get more done with less typing, and though c# is a powerful language, I’ve been wishing for a ruby like hash and even array initializers. I’ve been spending some time doing an ruby on rail’s active record port to c#, and lately i’ve been porting over the rail’s migration ( I even have a prototype working with SQL 2005). However, one thing heavily missing from the c# recipe is the Ruby like Hash for doing migrations. So after some research on the web, I found Alex Henderdon & Andrey Shchekin’s ruby like hash function for c#. However this didn’t exactly take this concept all the way as it could have, so after some tweaks to a Dictionary>string, object< class, simple ruby like hash for C# now exists and works fairly nicely, as you can see from the code example below. (Taken from the tests project).
Hash h = Hash.New(Name => "Michael Herndon", Age => 10, Url => "www.myspace.com"); h["Name"].ShouldBe("Michael Herndon"); h["Age"].ShouldBe(10); h["Url"].ShouldBe("www.myspace.com");
I’ve also packed up Andrew Peter’s Inflector.Net using C#’s mixins. Infector.Net is based off of the class rail uses to do things like camelize, pluralize etc. Also I’ve put together some other rails like mixins like .Gsup, .Merge, .Each. Collect, .Join, for people to enjoy. If you want to take a peak at code, its on the amplify-net googlecode project inside the folder Framework/Amplify.Linq folder.
svn checkout https://amplify-net.googlecode.com/svn/trunk/ amplify-net url: <a href="http://code.google.com/p/amplify-net/">http://code.google.com/p/amplify-net</a>