Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:44:57+00:00 2026-05-27T20:44:57+00:00

This method accepts as the last argument an integer, but I’m not sure I

  • 0

This method accepts as the last argument an integer, but I’m not sure I understand what I would use it for exactly.

Serializer.SerializeWithLengthPrefix(stream, object, PrefixStyle.Base128, [tag]);

The same holds true for the corresponding Deserialize method.

Is it just a way to tag messages to add some sort of “querying” capabilities on deserialization to filter out unwanted messages or does it have any other usages?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:44:58+00:00Added an answer on May 27, 2026 at 8:44 pm

    Basically, it is an additional marker that can be (although does not have to be) used to note the “type” of the message being added, since the presumption (when using the *WithLengthPrefix approach) is that there are multiple messages in the same stream.

    By being included, it also means that the entire composite stream is itself an entirely valid protobuf message.

    Ways of using this:

    • you can serialize a List<Foo>, and then repeatedly deserialize (with-length-prefix) individual Foo items, or vice-versa
    • with a heterogeneous set of objects, you can use the Serializer.NonGeneric API to allow type-resolution based on the tag, i.e. the code equivalent of “if 1 then Invoice; if 2 then Order, if 3 then skip it, if 4 then Customer”, etc – this is especially useful if using a NetworkStream as a message-sending device. This approach (using a different tag per type) allows you to read objects off the stream, and deserialize them correctly, without knowing in advance the type of the next message

    It is possible to omit this if you want – just pass zero (IIRC). This will save (typically) a byte per message appended, but: it means that the stream is no longer a valid protobuf itself. It can still be read, of course, by passing zero when reading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems to go against every design guideline. A static method that accepts a
We have a WebService with a method to upload images, this method accepts a
Suppose we have a method that accepts a value of an enumeration. After this
std::vector::erase() does not accept reverse iterator. Is there any way to call this method
This method works as expected - it creates a JTree with a root node
With this method declaration (no overloads): void Method(double d) { // do something with
Take this method /** * @return List of group IDs the person belongs to
Can this method work? public String sayHello(){ return Hello.jsp?name= + laala; } I am
I have this method on a webpart: private IFilterData _filterData = null; [ConnectionConsumer(Filter Data
Every time I call this method my NSMutableData is leaking and I cannot figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.