Rediscovering the Obvious

…stumbling in the footsteps of greatness

Linq to XML follow up – how the magic works

without comments

If you’re curious how the XNamespace works, just do a “Go to Definition” in VS and you’ll see the declarations, the key aspects are:

public static bool operator !=(XNamespace left, XNamespace right);
public static XName operator +(XNamespace ns, string localName);
public static bool operator ==(XNamespace left, XNamespace right);
public static implicit operator XNamespace(string namespaceName);

The last one is what allows me to write code like this and have it compile… note the lack of a constructor:

            XNamespace ns = “http://schemas.microsoft.com/winfx/2006/xaml”;

 

 

Written by erwilleke

February 27th, 2008 at 2:46 pm

Posted in Uncategorized

Leave a Reply