public static void SerializeCustomTypeArray(MemoryStream stream, Array array, CustomType customType)
 {
     SerializeByte(stream, (byte)SUType.CustomClass);
     SerializeByte(stream, customType.TypeCode);
     SerializeInt(stream, array.Length);
     for (int i = 0; i < array.Length; i++)
     {
         object v = array.GetValue(i);
         customType.SerializationFunc.Invoke(stream, v);
     }
 }
 public static void SerializeCustomType(MemoryStream stream, CustomType customType, object obj)
 {
     stream.WriteByte((byte)SUType.CustomClass);
     stream.WriteByte(customType.TypeCode);
     customType.SerializationFunc.Invoke(stream, obj);
 }