コード例 #1
0
        public void WriteThing(SomeMemoryStreamWrapperThing dest, object subject)
        {
            dest.Write(fullTypeBinaryRepresentationCache.GetOrCompute(simplifiedKvpType));

            using (dest.ReserveLength()) {
                dynamic s = subject;
                thisIsTotesTheRealLegitThingReaderWriterThing.WriteThing(dest, s.Key);
                thisIsTotesTheRealLegitThingReaderWriterThing.WriteThing(dest, s.Value);
            }
        }
コード例 #2
0
        public void WriteThing(SomeMemoryStreamWrapperThing dest, object subject)
        {
            dest.Write(fullTypeBinaryRepresentationCache.GetOrCompute(typeof(string)));

            var str = (string)subject;

            using (dest.ReserveLength()) {
                var bytes = Encoding.UTF8.GetBytes(str);
                dest.Write(bytes);
            }
        }
コード例 #3
0
        public void WriteThing(SomeMemoryStreamWrapperThing dest, object subject)
        {
            dest.Write(fullTypeBinaryRepresentationCache.GetOrCompute(simplifiedType));

            using (dest.ReserveLength())
                using (var slotCountReservation = dest.ReserveCount()) {
                    var writer = new WriterThing(thisIsTotesTheRealLegitThingReaderWriterThing, dest);
                    userTypeSerializer.Serialize(writer, (TUserType)subject);
                    slotCountReservation.SetValue(writer.SlotCount);
                }
        }
コード例 #4
0
        public void WriteThing(SomeMemoryStreamWrapperThing dest, object subject)
        {
            var byteArraySlice = (ByteArraySlice)subject;

            dest.Write(fullTypeBinaryRepresentationCache.GetOrCompute(typeof(byte[])));

            using (dest.ReserveLength())
                using (var countReservation = dest.ReserveCount()) {
                    for (var i = 0; i < byteArraySlice.Length; i++)
                    {
                        byteReaderWriter.WriteThing(dest, byteArraySlice.Buffer[i + byteArraySlice.Offset]);
                    }
                    countReservation.SetValue(byteArraySlice.Length);
                }
        }
コード例 #5
0
        public void WriteThing(SomeMemoryStreamWrapperThing dest, object subject)
        {
            dest.Write(fullTypeBinaryRepresentationCache.GetOrCompute(simplifiedCollectionType));

            using (dest.ReserveLength())
                using (var countReservation = dest.ReserveCount()) {
                    int count = 0;
                    foreach (var x in (IEnumerable)subject)
                    {
                        count++;
                        thingReaderWriterDispatcherThing.WriteThing(dest, x);
                    }
                    countReservation.SetValue(count);
                }
        }
コード例 #6
0
 public void WriteFrame(SomeMemoryStreamWrapperThing dest, object subject)
 {
     using (dest.ReserveLength()) {
         thisIsTotesTheRealLegitThingReaderWriterThing.WriteThing(dest, subject);
     }
 }