networking - C# Protobuf .NET Using Preexisting Byte Array -
so working protobufs in .net , trying incorporate them buffer pool , asyncsocketeventargs pool. buffer pool assigns sections of huge byte array event args.
so, problem, can't figure out way have protobufs serialize directly onto 1 of buffers. instead methods appear serialize onto there own buffers, wastes time/memory... way i'm looking for?
edit: have created proto scheme , generate messages contain deltas not entirely serialized classes, believe using attributes/serializer class won't me. want write bytes directly 1 of buffers. believe memorystream, have read still point created byte array, still waste lot of time/memory.
use memory stream
using system; using system.collections.generic; using system.linq; using system.text; using system.xml; using system.xml.serialization; using system.io; namespace consoleapplication1 { class program { static void main(string[] args) { person person = new person(); xmlserializer serializer = new xmlserializer(typeof(person)); memorystream stream = new memorystream(); serializer.serialize(stream, person); } } public class person { } }
Comments
Post a Comment