2010-09-12 127 views
0

這是我的代碼反序列化失敗

  DropDownList1.Items.Add(new ListItem(" Prueba1")); 
      DropDownList2.Items.Add(new ListItem(" Prueba1")); 

//string[] filePaths = Directory.GetFiles(@"\\hmfsw\web\DTCWIN107\MYSITE.com\public_html\post\"); 

// Make a reference to a directory. 
      DirectoryInfo di = new DirectoryInfo(@"\\hmfsw\web\DTCWIN107\MYSITE.com\public_html\post\"); 
      string path = @"\\hmfsw\web\DTCWIN107\MYSITE.com\public_html\linker\linker.xml"; 

// Get a reference to each file in that directory. 
      FileInfo[] fiArr = di.GetFiles(); 

// Display the names of the files. 
      foreach (FileInfo fri in fiArr)DropDownList1.Items.Add(new ListItem(fri.Name)); 


      System.Xml.Serialization.XmlSerializer serializer = 
      new System.Xml.Serialization.XmlSerializer(typeof(selector)); 
      System.IO.TextReader reader = 
      new System.IO.StreamReader(path); 
      selector s = (selector)serializer.Deserialize(reader); 
      reader.Close(); 

還行,第一件事情是,下拉列表澤斯不prueba1和prueba2

但下拉列表更新都與文件夾的信息更新...

第二個問題是serializer.Deserialize什麼也沒有。下拉列表不是用xml加載的...

你能幫我嗎?

感謝

回答

0

我沒有看到下拉列表和選擇之間有任何關聯。