ListBox.ObjectCollection未标记为可序列化

时间:2016-04-30 05:45:25

标签: c# serialization listbox binaryformatter

其他信息:在Assembly'System.Windows.Forms中输入'System.Windows.Forms.ListBox + ObjectCollection',Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'未标记为可序列化。

[Serializable]
public class User_List
{    
   public ListBox.ObjectCollection users;
}


// Getting the Data Ready
else if (temp is BPacket.Credentials)
{
   BPacket.Credentials U = (BPacket.Credentials)temp;
   OnlineUsers.Items.Add(loc.ToString() + " " + U.UserName);
   AllUsers[loc].UserName = U.UserName;

   BPacket.User_List UL = new BPacket.User_List();   
   UL.users = OnlineUsers.Items;

   SendOutData(UL);    
}

private void SendOutData(object temp)
{
   if (temp is BPacket.User_List)
   {
      for (int x = 0; x < NextLocation; x++)
      {
         formatter.Serialize(AllUsers[x].ConnStream, temp);  // send data //This is where the exception is thrown
      }

   }

} //END SendOutData

所以我想知道如何使我的User_List可序列化。

0 个答案:

没有答案