Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         byte[] abc = System.Text.Encoding.GetEncoding("gb2312").GetBytes(this.serializeTextBox.Text);
         object obj = PHPSerializer.UnSerialize(abc, System.Text.Encoding.GetEncoding("gb2312"));
         //object obj = serializer.Deserialize(this.serializeTextBox.Text);
         Hashtable al = (Hashtable)obj;
         foreach (object o in al)
         {
             if (o.GetType() == typeof(Hashtable))
             {
                 Hashtable ht = (Hashtable)o;
             }
             else
             {
                 System.Diagnostics.Debug.WriteLine(o.GetType() + ":" + o.ToString());
             }
         }
         for (int i = 0; i < al.Count; i++)
         {
             Hashtable ht = (Hashtable)al[i];
             //do something
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, "Error Deserializing: " + ex.Message, "Deserialization Error");
     }
 }