WriteValue() public abstract method

public abstract WriteValue ( [ stream, object value, [ session ) : void
stream [
value object
session [
return void
Esempio n. 1
0
 private static void WriteValues <T>(T[] array, Stream stream, ValueSerializer elementSerializer, SerializerSession session)
 {
     Int32Serializer.WriteValueImpl(stream, array.Length, session);
     if (typeof(T).IsFixedSizeType())
     {
         var size   = typeof(T).GetTypeSize();
         var result = new byte[array.Length * size];
         Buffer.BlockCopy(array, 0, result, 0, result.Length);
         stream.Write(result);
     }
     else
     {
         foreach (var value in array)
         {
             elementSerializer.WriteValue(stream, value, session);
         }
     }
 }
 private static void WriteValues <T>(T[] array, Stream stream, ValueSerializer elementSerializer, SerializerSession session)
 {
     stream.WriteInt32(array.Length);
     if (Utils.IsFixedSizeType(typeof(T)))
     {
         var    size   = Utils.GetTypeSize(typeof(T));
         byte[] result = new byte[array.Length * size];
         Buffer.BlockCopy(array, 0, result, 0, result.Length);
         stream.Write(result);
     }
     else
     {
         for (int i = 0; i < array.Length; i++)
         {
             var value = array[i];
             elementSerializer.WriteValue(stream, value, session);
         }
     }
 }