September 27, 2007 19:08 by garrymc
When I work with collections I’ll often want to retrieve information from the collection by its key. So my options are usually to make use the following generic collection (who uses any other type of collection now? Unless you’re stuck on .NET 1.1):
This is great collection except if you want to ever serialize it! Then you’ll have some problems. So the issue becomes do I want a collection which is searchable via an index and is serializable or one that is keyed but can’t be serialized. The problem however, is that in a lot of cases you actually want to be able to use both methods, that is search by ordinal number or index and be able to search by a key, which maybe a business key. To solve this issue many have resorted to inheriting from IList<T> then adding another item overload which iterates through the collection until you find a match. This works, but is probably not too efficient on large collections. Also it’s a pain to have to write this code each time.
With the introduction of .NET 2.0 Microsoft released a collection object which doesn’t get a lot of press. The reason why it’s not discussed very often is because it’s only provided in an abstract form. That is you have to create a concrete implementation before you can use it. As it turns out this is not that hard to do. For example the following C# code is an example of a simple implementation for an Order class: More...
September 10, 2007 21:29 by garrymc
Greetings its been awhile since my last post and this is largely due to the move from Sydney to Seattle. I've now made the move and have been working at Microsoft via a vendor for the past 3 months. I'm not allowed to say too much about the project at this stage, but I can say that its working with all the latest goodies such as WPF (Windows Presentation Foundation), WCF (Windows Communication Foundation) and WF (Workflow Foundation). I'll try and post some interesting bits I've learned (as samples) over the next few months. However, to kick start my blog again I'll be posting the Chapters to the book I tried writing a few years ago. Again while the content is based on .NET 1.1 the theory should be as useful today as it was when I wrote it. More...
This is the first of what hope will be many posts. I'll give you a brief run down of who I am and what I might blog about.
I'm a freelance application architect currently living in Sydney, Australia who's about to move to Seattle, WA and always on the look out for interesting projects. Which I'm sure you'll know are few and far between, so if you know of any let me know!! :).
Some of the things I'm working on at the moment which I plan to blog about in detail later are: More...