.Net
Easy Data-loading with LINQ-to-SQL and LINQ-to-XML
Mar 20th
.Net 3.5 had some nice tricks in it. LINQ-to-XML was one of them. With the new "X"-types, you can make working with XML really easy.
VB.Net 9 takes it one step further, and lets you write XML in your code without strings.
"Hey Rich, that’s old news," I hear you say. "And who’s interested in VB today anyway?"
Well, apparently there are a lot of VB-er’s still out there. I am mainly a C# developer myself, but I found that VB was perfect for a problem I had recently - loading of XML data into a SQL Server table.
Design Guidelines for LINQ
Mar 13th
Have you wondered if and when you should use the new LINQ features in .Net 3.5?
Like, where should I put a new extension method? Should I use Func<T> or a custom delegate? How do I best implement a mix-in (extension methods on an interface)?
Well, Mircea Trofin has just published a new draft of some LINQ design guidelines. You might just find your answers there.
Read Word Documents in a Web Browser
Mar 7th
I love this! Not because of the features, but because of the way it works.
Tim Sneath just blogged about TextGlow – an online Word docx file reader. The docx format is XML, and Silverlight 2 apps can use LINQ-to-XML to parse it and format it for display inside the browser.
Amazing!
You can read more about it on Tim’s blog.
Mix 08 WPF Scheduling Application
Mar 5th
Mix 08 seems to be much more mature than ever before. In previous years there were a lot of ideas being spoken about; this year there are much more implementations of those ideas available to look at. It seems like a lot of people have been working on the new technologies over the past year or so. Hopefully that will lead to the ripening of many technologies (especially WPF) to a point where we can actually use them.
As an example, there is a scheduling application available for Mix. Unfortunately it only runs on Vista, but I captured a video and made a few screenshots for you.
This is the opening screen, with an agenda for the 4 days of the event:
(Click the image to make it larger.)
Mix 08 Online Presentations
Mar 4th
My favorite conference is about to start: MIX 08.
It’s a great conference for Microsoft developers with an interest in the web. Last year they had some great talks about user experience and architecture. There’s always something interesting to learn.
Unfortunately I can’t be there (as usual), but all the sessions will be online. Tim Sneath just posted details of where and when you can watch them:
- The keynote with Ray Ozzie, Scott Guthrie will be available live at 9:30am Pacific / 5:30pm GMT on three streams: 750kbps, 300kbps, 100kbps.
- The breakout sessions and panels will be online within 24 hours of each session at MIX08 sessions.
ExtensionMethod.net – An Extension Methods Database
Mar 3rd
While surfing around tonight, I came across ExtensionMethod.net, a database of useful Extension Methods for C# 3.0 and VB 9. I thought it might be useful, so I added a few of my own extension methods.
There aren’t many there yet, but there are one or two on there from Scott Guthrie.
Have you got any code you could put up there? You could be one of the first if you go now.
Remove and Sort Those Ugly “using-Statements”
Mar 3rd
Visual Studio 2008 has lots of goodies in it, like LINQ syntax, CSS editing, and testing tools. There’s a lesser-known feature which I really appreciate though – the “Remove and Sort Usings” command in the C# editor.
You activate the command by placing your cursor over the using statements and clicking on the right mouse-button.
Refactoring C# Series: Aggregation of IEnumerable
Mar 2nd
I was recently reading Programming Ruby: The Pragmatic Programmers’ Guide, Second Edition, and came across this piece of example Ruby code:
[1,3,5,7].inject(0) {|sum, element| sum+element} -> 16
[1,3,5,7].inject(1) {|product, element| product*element} -> 105
Inject is a method which acts on an array by aggregating or accumulating the values within that array. It loops through the array, and for every item in the array, it performs a function. It then saves the result for the next iteration of the loop and eventually returns the aggregated value.
In C# 1.0 you would probably write such a method like this:
int sum = 0; int[] list = new int[] { 1, 3, 5, 7 }; foreach (int item in list) { // Perform some function, then save the result sum = sum + item; }
It’s a bit long-winded, and if you wanted to make it reusable, you’d have a hard time.
In C# 3.0, you can do it just like you can in Ruby.

