serialization - Effecient way to serialize jagged arrays using BinaryWriter -


stackoverflowers.

i wondering if has got tip on how should go on this. serializing regular primitive types using binarywriter (by length prefixing byte arrays). add entity primitivetypes dictionary have, want able serialize indefinite jagged array; doesn't matter if it's system.byte[][] or system.byte[][][][][][]

i need way prefix arrays' lengths , way tell deserializer how many arrays of arrays there are.

i thinking of way this, have been trying day.

just snippet of have come (it's not complete @ all, maybe conceptional approach);

     private sub writearray(writer binarywriter, type byte, array array)     writer.write(array.getlength(0)) 'writing length know how many arrays there are.     dim current type = array.gettype() 'getting type of (jagged-)array     if current.haselementtype andalso current.getelementtype.isarray 'checking whether it's jagged-array.         writer.write(true) 'writing true; represents it's jagged-array.         each array in array             writearray(writer, type, a) 'looping through same method until...         next     else '... it's not jagged. -- way problematic; of times there multiple jagged-arrays.         writer.write(false) 'not jagged.         select case type             case 0 '0 = byte, use other bytes strings/integers/etc.                 each obj byte in array                     writer.write(obj) 'because it's not jagged can write bytes                 next         end select     end if end sub 

hope see take part in discussion, , might come solution.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -