My LINQ Articles

I have been doing some LINQ/DLINQ articles over at codeproject.

Codeproject article link :LINQ Introduction 1 of 3

Heres a small taster of some of the LINQ standard query operators I discuss
in the article (the acticle does them all)


var iSmall = 
    from it in _itemList 
    where it.UnitPrice < 50.00M 
    select it;


 var namesAndPrices = 
     _itemList.Where(i => i.UnitPrice >= 10). 
Select(i => new { i.ItemName,i.UnitPrice }).ToList();


var MostExpensive2 = _itemList. 
OrderByDescending(i => i.UnitPrice).Take(2);


var itemOrders =    from i in _itemList 
join o in _orderList on i.ItemID equals o.OrderID 
select new { i.ItemName, o.OrderName };


var itemNamesByCategory =    from i in _itemList 
group i by i.Category into g 
select new { Category = g.Key, Items = g };


var inter = (from i in _itemList select i.ItemID).Distinct() 
.Intersect((from o in _orderList select o.OrderID).Distinct());


var query = _itemList.ToArray(). 
Where(i => i.Category.Equals"Food"));


var foodCat = (from i in _itemList 
where i.Category.Equals("Food")  

select i).Count();


var totals = (from i in _itemList select i.UnitPrice).Sum();

Thats really only a few of the LINQ standard query operator, there are many many more
mentioned at the article link at the top of this section.

Ive also be doign some DLINQ stuff, and done an article about that as well.

Codeproject article link :DLINQ Introduction 2 of 3

This article discusses the use of the DLINQ designer, the enitity code file generation using the SQLMetal.exe tool,
and also shows some standard DLINQ queries and updates in action

I’ve even attracted the attention of a Mr Joe Rattz, who is just about to publish a LINQ book his blog is here he liked my articles, as did the totally awesome Marc Clifton. So I must be something right. You decide.

Hope you like them

Current Work

Visual Studio Templates “Out Of Date”

Today I started up my beloved Visual Studio 2005, and it said “No Visual Studio template information found”. Mmm. Bad news. Accepting this message, all my normal project types (templates) were not present. It turns out this is easiliy fixed with the following command line

C:Program FilesMicrosoft Visual Studio 8VC>devenv /installvstemplates

So if you get this message, simplu use that command line, and bingo your good to go again

Current Work, Significant Projects (Shareable)

NetPics : My MSc Project

NetPics Web Site : NetPics

I am currently doing my Msc at Sussex University, and as for my degree we have to do a final project. So I chose to do something like Flickr, where people could share media with friends. At the moment I only allow images to be shared, but this could be any media, such as video, music, documents etc etc.

The idea is that a web user may share with their friends, and the freind can log into the same portal and view the shared content. But I also wanted to write an app, that would allow the user to upload very quickly using standard desktop techniques such as drag and drop. In fact they should not even be aware that they actually creating web content. To this end the project will use a dektop application, and an ASP .NET web app, and the desktop app will upload content using a web service. Thats the basic idea anyway.

Although I am still doing my MSc, and this project is still under development. A few screen shots cant hurt now can it.

The Web Site

This uses ASP .NET, and will use custom ASP .NET controls, and Ajax to allow the user to drag around pictures to form new albums etc etc





The Desktop App

The desktop app is .NET 2.0 stuff all the way. C# of course. The user of the desktop app will be able to create albums, edit images, view a slide show of image etc




The image editing is done, thanks to the use of the IPLab image processing library, by Andrew Kirillov. The IPLab is available here

I am hoping this will do even better than my BSc project. Ill let you know when ive done it, and its marked.


Some Other Areas That Ive Also Worked In

Obviously when one is employed (as I have been since I was about 18 or so, even during my degree) one has to be mindful of keeping customer sensitive information, private. As such I have worked on many many interesting projects that you would all love, but alas I can not share code for, as it is private customer data.

I can however state the application of some of the more exotic systems that I have worked on :

  • Colourant plant automation and recipe management system, for Clairol hair dye (yes them on TV)
  • Serial comms protocol definitions for some very wacky serial comms stuff, talking to C# code. My boss at the time did the code.
  • Assisted in the development of our own automation layer written entirely in C#, with support for OPC
  • Support for numerous blue chip UK based companies
  • Integration of Management Excecution Systems world wide for Procter & Gamble
Significant Projects (Shareable)

ReMp3 : My BSc Project

ReMp3 Web Site : ReMp3 | Sussex University : Prizewinning projects

For my final year degree project at Sussex University (2006), I decided to write an application that would allow the following features:

  • Allow a user to construct a local playlist of music
  • Allow a user to RIP a CD to MP3 / WAV
  • Allow a user to create a media catalogue
  • Allow a user to convert from WAV to MP3
  • Allow a user to edit ID3 tag information for v1.0 / v1.1 ID3 tags
  • Save all track list information in XAML where it could also be validated
  • Allow a 2nd PC to control what was played on another PC, like a remote control.

So that was the requirements, and what I came up with was the ReMp3 project. It did fairly well overall, and I was quite happy with it. I ended up getting 1st place prize and being awarded an award by the British Computer Society.


It looked like the figure shown above here. There were 2 applications a server and a client. And is made use of host of .NET technologies such as Threading, Remoting, DataAcess (ADO .NET), Custom Controls, XML Parsing, Patterns, and Pinging.

Server App

The server app shown below, consisted of 6 main tabs, which were as follows:

  • Home
  • Media Player
  • Mp3 Editor
  • Media Library
  • CD-Ripper
  • WAV to MP3


Ill now show a screen shotof each of those controls

Media Player

For this control I used the Microsoft Media player, and wrote a wrapper around it, to carry out track lists, drag and drop, reordering of tracklist. One point was that a user could consruct a tracklist of any items on their network, and save that tracklist. As such I had to 1st Ping the host to make sure the tracks read from the saved tracklist, could still be found.


MP3 Editor Control

This control was really about byte frigging, as the ID3 information is part of the MP3 file, so it all about maniupulating bytes within the MP3 file.


Media Library Control

This is fairly straight forward ADO .NET stuff, except that I threaded all this recursive folder scanning, to free up the UI.re2.png

CD Ripper Control

Although id like to take the credit for this one, the code was mainly sourced at codeproject


WAV to MP3 Control

Although id like to take the credit for this one, the code was mainly sourced at codeproject


Client App

The client app shown below, consisted of 2 main tabs, which were as follows:

  • Track List
  • Media Library

Track List

This used .NET remoting to call methods on the Server form. It also had to be threaded to allow the server to block under certain conditions where the Client had to block waiting on the server. For instance when the current playing track changes is not a function of the Client but rather the Server, so the Client had to wait for the Server to notify it of a change.

This also used some unmanaged P/Invoke calls to obtain a list of network PCs, that a server could be picked from.



Media Library

The same as the Server app

AutoDiagrammer : My Reflector Addin, Current Work, Significant Projects (Shareable)

AutoDiagrammer : My Reflector Addin

At the beginning of March 2007, i published an article at codeproject about drawing a class diagram using reflection. This article is available here.

The thing being, as more and more people looked at it, they all wanted it to be available as an addin for Lutz Roeder C# De-Compiler which is free and available here.

So finally I gave in, and had a go at getting it to work as a reflector addin, I think i’ve now got there with v1.9 of AutoDiagrammer, which is available right now at the AutoDiagrammer auto update link.


Ive also kept most of the stand alone application features such as :

  • Zoomable window
  • Printing
  • Customization of what is shown on the diagram
  • Save to image


I have also now included any associations as a Tooltip, so when there are a lot of classes with a lot of lines going everywhere, simply point the mouse at a class, and see what it tells you.


I’m just waiting for the codeproject staff to update the article, and then ill be giving Lutz the Addin for official release at his CodePlex site. And then im sure there will be pleny of folk that will have some more suggestions….


DLINQ Gotchas

I have just written a new codeproject article about DLINQ using the May 2006 CTP and have stumbled on a few things, that may interest some folk.

Im aware (and have even downloaded the Virtual PC version of) Visual Studio “Orcas”, which now has May 2007 CTP LINQ stuff included. So these gotchas may no longer exist. But ill list them anyway

In my article I am dealing with a Winforms app, so am using a DataGridView to show the results of any queries. I only came across 2 things really:

I am obviously dealing with a Winforms app here, so am using a DataGridView to show the results of any queries. I only came across 2 things really:

  1. When trying to bind the results of a DLINQ query to the DataGridView I had to use the undocumented ToBindingList() on the end of a DLINQ query to be abe to set it as the datasource for the DataGridView
  2. Normally a DataGridView allows its bound contents to be sorted using a column click. Attempting this with DLINQ query bound to the DataGridView , causes an Exception “DataGridView control cannot be sorted if it is bound to an IBlindingList that does support sorting”

The 1st one is fair enough once you know about it.

The 2nd point, Mmmm thats bad. So I had a hunt about and found this article:

bindinglist and DLinq
which kind of says that in the May 2006 LINQ CTP version of LINQ there is limited binding support, and its all going to get better in future. So I guess well just have to wait for Visual Studio Orcas to be released officially.

Current Work

What Am I Up To These Days (LINQ/DLINQ/XLINQ)

I have only really just started to become a blogger, so theres not much content here yet. But I will be adding new tips and tricks when I come across them, as well as links to my most current activites.

In fact I have just published my 1st LINQ article at codeproject which is available here.

This is the 1st part of a 3rd part series the next parts (im 90% through with part 2) will be on DLINQ (or XLINQ over SQL as its now called) and XLINQ.

I will be publishing a few gotchas about DLINQ here very shortly, that people using the old May 2006 CTP should watch out for. Im aware (and have even downloaded the Virtual PC version of) Visual Studio “Orcas”, which now has May 2007 CTP LINQ stuff included. So these gotchas may no longer exist