WriteXml has various overloads.
public void WriteXml(out string entityCollectionXml)
is the most simple one. It will return the entity collection in XML in the form of a string. call it like this:
string xml = string.Empty;
customers.WriteXml(out xml);
// now 'xml' contains the collection in XML. You can now save xml with a streamwriter.
public void WriteXml(XmlDocument parentDocument, out XmlNode entityCollectionNode)
is more complex, you pass in an XmlDocument object in which you want to have the collection XML. It returns the node which contains the complete tree of XmlNodes with the collection data. This node is created with the passed in XmlDocument and thus can be added to it without hassle.
public void WriteXml(string rootNodeName, out string entityCollectionXml)
This is also a simple one. It is almost the same as public void WriteXml(out string entityCollectionXml) but this version lets you specify the root node name, for example "MyCollection", so the rootnode will be <MyCollection>.
public virtual void WriteXml(string rootNodeName, XmlDocument parentDocument, out XmlNode entityCollectionNode)
You might guess what this one does
It's the same as public void WriteXml(XmlDocument parentDocument, out XmlNode entityCollectionNode) but now lets you specify the name of the root node.
I hope this clears something up