Example #1
0
 public override void pack(object obj, ITransport transport)
 {
     if (obj == null)
     {
         Int32.pack(0, transport);
     }
     else if (obj is T[])
     {
         T[] val = (T[])obj;
         Int32.pack(val.Length, transport);
         foreach (T item in val)
         {
             type.pack(item, transport);
         }
     }
     else
     {
         IList <T> coll = (IList <T>)obj;
         Int32.pack(coll.Count, transport);
         foreach (T item in coll)
         {
             type.pack(item, transport);
         }
     }
 }
Example #2
0
 public override void pack(object obj, ITransport transport)
 {
     if (obj == null)
     {
         Int32.pack(0, transport);
     }
     else
     {
         ICollection <T> coll = (ICollection <T>)obj;
         Int32.pack(coll.Count, transport);
         foreach (T item in coll)
         {
             type.pack(item, transport);
         }
     }
 }
Example #3
0
 public override void pack(object obj, ITransport transport)
 {
     if (obj == null)
     {
         Int32.pack(0, transport);
     }
     else
     {
         IDictionary coll = (IDictionary)obj;
         Int32.pack(coll.Count, transport);
         foreach (DictionaryEntry item in coll)
         {
             keytype.pack(item.Key, transport);
             valtype.pack(item.Value, transport);
         }
     }
 }
Example #4
0
            public override void pack(Object obj, ITransport transport)
            {
                HeteroMap map = (HeteroMap)obj;

                if (map == null)
                {
                    Int32.pack(0, transport);
                }
                else
                {
                    Int32.pack(map.Count, transport);
                    foreach (DictionaryEntry e in map)
                    {
                        AbstractPacker keypacker = map.getKeyPacker(e.Key);
                        AbstractPacker valpacker = map.getValuePacker(e.Key);

                        Int32.pack(keypacker.getId(), transport);
                        keypacker.pack(e.Key, transport);

                        Int32.pack(valpacker.getId(), transport);
                        valpacker.pack(e.Value, transport);
                    }
                }
            }