Providing InnerXml to XElement

In my latest project, I dived in to the world of Linq, by using Linq to Sql. As I have loads of XML related application logic I also got to use Linq to XML. We have XElement class given to us from System.Xml.Linq namespace which has loads of usefulness over the old world XmlElement class. So there I go admiring XElement, but wait I don’t have an InnerXml method, that lot of us have gotten used since the MSXML DOM days.

I came up with providing an Extension method InnerXml() on XElement.

public static string InnerXml(this XElement element)
{
StringBuilder innerXml = new StringBuilder();

foreach (XNode node in element.Nodes())
{
// append node's xml string to innerXml
innerXml.Append(node.ToString());
}
return innerXml.ToString();
}

Someone was exactly looking for this on StackOverflow (the awesome tech QnA site that is in private beta right now)

Visual Studio 9 SP 1 and .Net Framework 3.5 SP 1

Microsoft announced the release of Visual Studio 9 SP 1 and .Net Framework 3.5 SP 1

Some of the important features included are:

  1. Net Framework Client Profile - 86.5% reduction from 197 MB 26.5 MB for applications deployment
  2. WPF Designer - Improvements
  3. Entity Framework for DATA access to different data providers (as opposed to Linq to Sql)
  4. Changes to CLR that improve application startup time by 20-45 %
  5. ADO.Net data services
  6. WPF enhancements with Hardware acceleration

Last but not the least, I would like to call it “VS 9“, rather than “Visual Studio 2008″, because it is short and also there is a nifty 9 in the icon, like so,

VS 9 icon
VS 9 icon

Same method two interfaces

If a C# class that inherits two interfaces is implementing a method. Both the interfaces have the same method with the same signature. What happens?

public class Address : IPersonalAddress, IBusinessAddress
{
    // We don't have no apt here
    public string GetAddress(int building,
        string street,
        string city,
        string state)
    {
        return building.ToString() + ", " +
            street + ", " +
            city + ", " +
            state;
    }
}

interface IPersonalAddress
{
    string GetAddress(int building,
        string street,
        string city,
        string state);
}

interface IBusinessAddress
{
    string GetAddress(int building,
        string street,
        string city,
        string state);
}

a. Compilation error

b. Nothing happens

c. Method from the first interface inherited, gets called

d. Runtime error

e. None of the above

Well the answer is it compiles fine and nothing happens. Why should anything happen? An interface does not have any concrete implementation significance, thus the class that implements the interface becomes more important here. So the method gets called and gets executed as if a normal method of the class.