Problems posting comments?

Some of you may have been frustrated by how hard it is to post comments to this blog – the human verification step seems to be a bit off. I’m trying to find out what’s going wrong, but until it’s fixed, please just mail me with the comment, including your name and the optional URL you want on the comment, and I’ll post it as soon as I get time. I’d far rather take the time to do that than lose the comments!

Nasty generics restrictions

So, I caved and finally downloaded the LINQ preview. Obviously it’s fairly heavily genericised (if that’s even a word) and I decided to push it a little. Nothing particularly heavy – just an interesting bit of functional programming. It’s easy to do a query which returns a string property from an object: var items = new[] { new {Data = “First”}, new {Data = “Second”}, new {Data = “Third”} }; IEnumerable<string> query = from item in items select item.Data; foreach (string s in query) { Console.WriteLine (s); } The above prints out: First Second Third It’s not particularly hard to … Continue reading Nasty generics restrictions

Improvement to extension method syntax

I’m blogging this before my sleep-deprived mind (3 hours in the last 33, and I’m getting up for the day in an hour or so) loses it. One of the things I don’t like about the proposed extension methods is the way the compiler is made aware of them – on a namespace basis. “Using” directives are very common to add for any namespace used in a class, and quite often I wouldn’t want the extension methods within that namespace to be applied. I propose using using static System.Query.Sequence; instead, in a way that is analogous to the static imports … Continue reading Improvement to extension method syntax

LINQ, DLinq, XLinq and C# 3.0

Some readers may already be aware of Project LINQ – .NET Language Integrated Query. There have been various posts about it (and in particular the effect it has on C# itself) on the C# newsgroup, and many of those have involved a certain amount of speculation. This is understandable, as it’s still very much under development, and although a sample initial implementation has been available since the PDC, I’d be surprised if things didn’t change. I haven’t downloaded the PDC implementation, and don’t intend to for a while. I have, however, finally had a chance to read the specs and … Continue reading LINQ, DLinq, XLinq and C# 3.0

Overuse of regular expressions

I’ve been having a discussion on the C# newsgroup about the best way of searching for multiple strings in a single string. The question posed was how to find out whether any of the strings “something1”, “something2” and “something3” were contained within another string. The suggested response was to use regular expressions. Personally, I think this is using a sledgehammer to crack a nut – and a dangerous sledgehammer at that. Now, I want to make it perfectly clear from the start that I have nothing against regular expressions – I think they’re very powerful, and can save a lot … Continue reading Overuse of regular expressions


So, I’ve finally got round to acquiring a blog, thanks to Susan Bradley. I’ll probably be using this as a “dumping ground” for very short articles which haven’t quite made it as far as my main C# page. You can reasonably expect that some posts here will eventually be expanded into articles. As a sample of the kind of thing I’m interested in writing about, you should probably visit my C# page if you haven’t already done so. Right, that’s enough waffle – see you in the real posts…