Monitoring change in XML data (LINQ to XML series – Part 5)

This is the 5th part in a series on LINQ to XML. In this instalment we will look at monitoring changes in XML data in the XML classes added to .NET 3.5. The XObject class (from which XElement and XAttribute, among others) contains two events that are of interest to anyone wanting to know about […]

Tip of the Day #4 (Connection Strings in Config files)

From .NET 2.0 onwards a new and improved configuration management system has been put in place. You can now add a <connectionString> element to the config file and use it to place the connection strings to the database and then retrieve then in a consistent way in your application. It supports multiple connection strings too […]

Functional Programming in C#3.0

Oliver Sturm spoke to to Scottish Developers in Glasgow earlier this week to a packed room! His topic was Functional programming in C# 3.0. The feedback was overwhelmingly positive and he received comments such as “Great code examples” and “very worthwhile”. So, if you missed last nights session, or you just want to review the […]

Crazy Extension Method

Here is an example of a crazy extension method that alters the semantics of method calling. First the extension method: public static class MyExtensions { public static bool IsNullOrEmpty(this string target) { return string.IsNullOrEmpty(target); } } Instead of calling the static method IsNullOrEmpty() on string, we are turning it around to allow it to be […]

Getting values out of XML in .NET 3.5 (LINQ to XML series part 2)

In my last post I gave a brief introduction to some of the new XML classes available in .NET 3.5. In this post I’ll continue that introduction by explaining how to get information out of the XML. First off, lets assume we have some XML that looks like this: XElement root = new XElement(“root”, new […]

Introduction to LINQ to XML

Last year I wrote about the new languages features available in C# 3.0 (Anonymous Types, Extension Methods, Automatic Properties, A start on LINQ, Object Initialisers I, Object Initialisers II, & Object Initialisers III) and since then I’ve really got in to LINQ, especially LINQ to XML. The reason for that is that I hate XPath […]