Introducing ActiveSupport.NET

To my surprise, none of my googling seemed to come up with anyone doing this.  So I figured I’d start it off (please let me know if you know of any other efforts already underway).  As some would say, taking extension method abuse to a whole new level.  😀  But, I see these little utility methods to be a good fit as extensions methods to make the syntactic sugar that much sweeter.

One of the many great things about working in Rails is the core extensions in the ActiveSupport library.  It just *becomes* part of the Ruby language as you work with Rails.  And I wanted to get that same feeling when working in C#.  So this is my attempt to start porting over the core extensions from Ruby’s ActiveSupport Library.

So far I’ve just ported over a few string access and conversion extensions, but check ’em out and let me know if you’d find something like this to be useful.  Here are some examples of what’s currently supported…

 1: // some accessors
 2: "blah".At(2) // 'a'
 3: "blah".First() // 'b'
 4: "blah".First(2) // "bl"
 5: "blah".From(1) // "lah"
 6: "blah".Last() // 'h'
 7: "blah".Last(2) // "ah"
 8: "blah".To(2) // "bla"
 10: // couple simple conversions (still needs lots of work)
 11: "1/4/2008".ToDate() // DateTime
 12: "01:15:35".ToTime() // DateTime

You can grab the source at its google code repository.  You can just do a “build test” from a command line in the trunk to run the unit test suite.

Enjoy.  🙂