Пример #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);
            }
        }
        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);
            }
        }
        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);
                }
        }
        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);
                }
        }
        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);
     }
 }