Never let it be said that I can’t say something nice about a Microsoft product. I’m not enthusiastic about VS2008 itself until ReSharper 4.0 is here and stable, but the new language features rock! I haven’t even touched any of the LINQ dialects yet, but all those little features that Anders and co added to support LINQ are already making my life easier.
- Extension Methods: I’m mostly using Bellware’s nunit-spec extensions for RSpec-style assertions in unit tests like someObject.SomeMethod().ShouldEqual(expected); I’ve also used them very sparingly to extend a fluent interface from an external assembly. It’s working, but let’s call that an experiment in progress
- Object Initializers: These make test data setup code soooo much more compact. Especially the initializers for collections. As silly as it sounds, I’d almost call this the single best thing about .Net 3.5 just because of the mechanical savings.
- Lambda Expressions: Besides being so much tighter than anonymous delegates, I’m digging the ability to get at the expression tree. My old MicroControllers idea in C# 3.0 looks like this: _binder.Bind(x => x.QuoteDate).To(quoteDateField).WithLabel(quoteDateLabel); See the little Lambda trick in bold? Gotta love the compiler safe reflection goodness. The tighter syntax is also making it easier to utilize some functional-lite programming that cuts down on code here and there.
What do you like about C# 3? What are you doing that wasn’t possible in C# 2?