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 6755119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:21:44+00:00 2026-05-26T13:21:44+00:00

Is it possible to serialize a tuple of memory streams created by a binarywriter

  • 0

Is it possible to serialize a tuple of memory streams created by a binarywriter using Protobuf.net? If I try that, the Protobuf says that it cannot serialize a stream.

What I am after is to serialize a tuple of jagged arrays. I do not want to convert them into 1D arrays because I believe it is not necessary. So I thought that I would serialize the jagged arrays to the memory stream on my own, but I want the Protobuf.net to serialize the tuple for me. I need to have the overall serialization / deserialization as fast as possible.

EDIT:

My overall goal is to send the following jagged array tuple through WCF as fast as possible no matter how. The overall time from jagged array to jagged array counts.

// F# interactive code
#time "on"
#r @"d:\Protobuf\protobuf-net.dll"

let getJaggedArray () =
  let size = 100
  let rnd = System.Random 1
  Array.init size (fun i ->
    Array.init size (fun j ->
      Array.init size (fun k ->
        rnd.NextDouble() )))

let wcfData = (getJaggedArray (), getJaggedArray ()), getJaggedArray ()

let file = new System.IO.FileStream ("test.bin", System.IO.FileMode.Create)
ProtoBuf.Serializer.Serialize (file, wcfData)
file.Close()

// === Future use ===
//[<ServiceContract>]
//type IWCF =
//  
//  [<OperationContract>]
//  [<ProtoBehavior>]
//  abstract Send: wcfData -> unit
  • 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-26T13:21:45+00:00Added an answer on May 26, 2026 at 1:21 pm

    Protobuf-net does not current have any specific handling of streams (although it will handle byte[]), although I guess it could simply consume the Stream (serialize) and reproduce a MemoryStream (deserialize). If you didn’t want to change your model, it should be possible to register a “surrogate” for Stream that does exactly that in only a few lines of code (let me know if that is of interest).

    It has automatic support for most common “tuple” patterns, but jagged data is again an issue – although again, this could be handled if we really needed (more commonly, having an outer- list of objects that themselves have an inner-list is a pragmatic workaround to “jagged”, and works currently).

    If you can post a more complete (ideally runnable) example, I may be able to offer more guidance.

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

Sidebar

Related Questions

Is it possible to (de)serialize a POCO type using neither protobuf-net attributes nor explicitly
I'm using C# with .NET 3.5. Is it possible to serialize a block of
Is it possible to serialize an ASP.NET web form, including all data that a
possible duplicate: Cannot serialize parameter of type ‘System.Linq.Enumerable… ’ when using WCF, LINQ, JSON
It seems that if it were possible to serialize data as the raw memory
Is it possible to serialize and deserialize a class in C++? I've been using
Is it possible to serialize a method containing yield statements (or a class that
Using Zend_Amf it's possible to serialize php objects to/from Adobe AMF format. Is there
To Serialize a class with protobuf-net, you neet to provide the class and property
Is it possible to serialize data structures (using boost::serialization) into string variable or buffer

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.