Bf2af16812228b5a54daeb30c96efaf2

Very simple piece of code which returns a specific XmlNode. Any changes are welcome

public static XmlNode ViewFields
{
  get
  {
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<ViewFields/>");
    return doc.FirstChild;
  }
}

Refactorings

No refactoring yet !

F9a9ba6663645458aa8630157ed5e71e

Ants

March 8, 2010, March 08, 2010 17:11, permalink

No rating. Login to rate!

I think that there is some kind of design issue where you aren't retaining the parent XmlDocument object that you are instantiating on line 5. But if you really don't care about actively tracking the document, try this code below.

public static XmlElement ViewFields
{
     get { return new XmlDocument().CreateElement("ViewFields"); }
}

Your refactoring





Format Copy from initial code

or Cancel