Use a GUID for a filename - they're guaranteed to be unique, and therefore aren't susceptible to stopping/restarting the program.
for (int indx = 0; indx < contact.Fields.Count; indx++)
{
string guid = Guid.NewGuid().ToString().Replace("-","").Replace("{","").Replace("}","");
StreamWriter sw = new StreamWriter(string.Format("D:\\Temp\\{0}.xml", guid));
sw.WriteLine(contact.Xml);
sw.Flush();
sw.Close();
}
If you don't want to delete the hyphens or curly braces, remove the Replace() method calls.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001