ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#โ€ข3y agoโ€ข
15 replies
Ole (ping please)

Deserializing binary data

I have the following structures:

Root:
    int32             nameLength
    byte[nameLength]    name
    int32            numItems
    Item[numItems]        Items

Item:
    int32             itemNameLength
    byte[itemNameLength]    itemName
    int32            VertexLength
    Vertex[ArrayLength]    VertexList

Vertex:
    float    X
    float     Y
    float     z
Root:
    int32             nameLength
    byte[nameLength]    name
    int32            numItems
    Item[numItems]        Items

Item:
    int32             itemNameLength
    byte[itemNameLength]    itemName
    int32            VertexLength
    Vertex[ArrayLength]    VertexList

Vertex:
    float    X
    float     Y
    float     z


I am curious, what is the best way to serialize this? Currently I simply read it into a stream and reads one attribute at the time. Coming from a c++ background this feels highly inefficent.
When I try to google the problem I dont get a lot of new results, but I suspect there might be some changes to the language in the last 10 years which have improved tasks like this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

โœ… Looking for assistance in Deserializing Avro Binary stream
C#CC# / help
3y ago
Dynamically generating C# classes for deserializing data
C#CC# / help
2y ago
โ” Deserializing JSON
C#CC# / help
3y ago