Fastest way of creating XML from parent-child table in c#?

Posted by rudnev on Stack Overflow See other posts from Stack Overflow or by rudnev
Published on 2010-04-05T09:09:34Z Indexed on 2010/04/05 9:13 UTC
Read the original article Hit count: 234

Filed under:
|
|
|

Assume we have some DataTable or IEnumerable with ChildID, ParentID and Title. We need to serialize it to XML like

<Entity title="">
   <Entity title=""></Entity>
   <Entity title=""></Entity>
</Entity> 

As i found out, standard DataTable.GetXML() returns something different. I thought about initializing class tree like Entity e = new Entity(ID, Title, ParentEntityID) and then serializing it. Table is about > 3000 elems. Is there faster way?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about c#