title: Xml Content Changed After Serialization & DeSerialization
body: <p>I updated the question @
  <a href="https://stackoverflow.com/questions/18899453/xml-content-changed-after-serialization-deserialization-want-to-pass-in-xml-to">xml content changed after serialization &amp; deserialization want to pass in xml to map object</a></p>
  
  <p>Any help are appreciated. Thanks a lot.</p>
  
  <p>I am new to all of these:
  I am trying to pass in an xml file from a webapplication browse button to a service, call and then run it.</p>
  
  <p>I searched and did the following:</p>
  
  <pre><code>string InputFilePath = FileUpload1.PostedFile.FileName;
  
  MyServiceTypeClass _MyServiceTestObj = new MyServiceTypeClass ();
  XmlSerializer SerializerObj = new XmlSerializer(typeof(MyServiceTypeClass ));
  StreamWriter WriteFileStream = new StreamWriter(@InputFilePath);
  SerializerObj.Serialize(WriteFileStream, _MyServiceTestObj );
  WriteFileStream.Close();
  
  FileStream XmlStream = new FileStream(@InputFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
  MyServiceTypeClass _ServiceTypeLoaded = (MyServiceTypeClass )SerializerObj.Deserialize(XmlStream);
  XmlStream.Close();
  </code></pre>
  
  <p>After I run it and upload an xml file, I found that <code>_ServiceTypeLoaded</code> fields are almost all null for the fields. And the xml file content has been changed after running the above lines. 
  <code>_ServiceTypeLoaded</code> only has 3 fields not <code>null</code>, and the xml file has changed to other format with lots of tags missing.</p>
  
  <p>Some More Details:<br>
  <code>MyServicetypeClass</code> structure:<br>
  <code>MyServiceTypeClass</code> inherited from Class A and has some of its own members; Class A inherited form Class B and has some of its own members; Class B inherited from Class C and has some its own members etc. There are 5 layers in the relationship.</p>