Ejemplo n.º 1
0
 public static void PutList <T>(Stream data, List <T> list, PutData <T> action)
 {
     if (list == null)
     {
         PutU16(data, 0);
     }
     else
     {
         int len = list.Count;
         if (len > UInt16.MaxValue)
         {
             throw new IOException("PutList overflow : " + list + "\nSize=" + len);
         }
         PutU16(data, (ushort)len);
         for (int i = 0; i < len; i++)
         {
             action.Invoke(data, list[i]);
         }
     }
 }
Ejemplo n.º 2
0
 public static void PutArray <T>(Stream data, T[] array, PutData <T> action)
 {
     if (array == null)
     {
         PutU16(data, 0);
     }
     else
     {
         int len = array.Length;
         if (len > UInt16.MaxValue)
         {
             throw new IOException("PutArray overflow : " + array + "\nSize=" + len);
         }
         PutU16(data, (ushort)len);
         for (int i = 0; i < len; i++)
         {
             action.Invoke(data, array[i]);
         }
     }
 }