0

在下面的代码中,我有tempGsContact 哪个是对象,它是一个方法的值,然后我解析 Into XML writer,如图所示。我需要读取检索到客户端的每个对象,而无需在所有对象完成后等待。我能做些什么来实现这一目标?我希望我的问题很清楚!

using (XmlWriter xmlWriter = XmlWriter.Create(HttpContext.Current.Response.OutputStream, xmlWriterSettings))
                {
     for (int count = 0; count < length - 1; count++)
      {
                tempGsContact = ConvertStringToContactObject(_fileContacts[count]);
               if (tempGsContact != null)
                {
                   tempGsContact.ContactSubInfo.Sort(new Comparison<GSContactInfo>((x, y)                 => string.Compare(x.ContactPropertyTitle, y.ContactPropertyTitle)));                                           
                 _fileContacts = null;
                   #region Convert Contact To XML Format                                            
                  xmlWriter.WriteStartElement("Contact");
                  xmlWriter.WriteAttributeString("Name", tempGsContact.DisplayName);
                  xmlWriter.WriteEndElement();
                  xmlWriter.Flush();
                  #endregion                                          
                }
       }
}
4

0 回答 0