Change XmlNode name?

A

Adam Clauss

I am working on a class who's base class contains a method to generate an
XmlNode (a representation of the object's properties).

Now, in my subclass I will also have an overriden method to do the same
thing, and will simply call the base class first (to take care of all base
class properties before I do mine).
I was hoping I could just take the XmlNode returned by the base class, add
my extra information to it, rename it to my class, and return.

However, it seems you cannot set the name of an XmlNode after it has been
created (the Name property is only get, not set). Is there any way around
this?
 
N

Nicholas Paldino [.NET/C# MVP]

Adam,

I don't believe there is a way around this. What you could do though is
create a new node, and then copy all of the children of that node, and
return that. The copy operation should be easy enough.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top