Streamwriter.Writeline and File.WriteAllText writing text out of order

guidedogpuppy

New Member
I'm having an issue where I'm writing the contents of several xml files to one file. When I run the program, the output is in the proper format, but the words are out of order. An example of this:My string is \[code\]"<s:AttributeType name=\"Shift\" number=\"34\" nullable=\"true\" writeunknown=\"true\">"\[/code\]So it should print \[code\]<s:AttributeType name="Shift" number="34" nullable="true" writeunknown="true">\[/code\]But instead \[code\]<s:AttributeType name="Shift" writeunknown="true" number="34" nullable="true">\[/code\]is returned.Some of the file is written in using \[code\]File.WriteAllText(@"C:\Users\status.xml", xsh);\[/code\]Where 'xsh' is a variable containing a string.The rest is written in using this loop:\[code\] foreach (var i in Numbers.GetWSnumber()) { string contents = ""; string curFile = @"\\production\public\Staus\TStatus\WS" + i.SetId + ".xml"; if (File.Exists(curFile)) { System.IO.StreamReader file = new System.IO.StreamReader(curFile); while ((contents = file.ReadLine()) != null) { using (StreamWriter sw = File.AppendText(@"C:\Users\status.xml")) { sw.WriteLine(contents); } } file.Close(); } }\[/code\]Any help is appreciated
 
Back
Top