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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:47:06+00:00 2026-05-27T05:47:06+00:00

I started using Protobuf-Net in C# and WPF projects. I have a class that

  • 0

I started using Protobuf-Net in C# and WPF projects. I have a class that looks like this:

Class Study – Contains a collection of Clinical Finding Objects; each Clinical Finding object contains a collection of screen shot objects (instances of the screen shot class).

When I serialize the Study object – the Clinical Findings are getting serialized correctly. However the inner collection of Screen shot objects contains within each Clinical Finding object is NOT getting serialized.

This works properly with Binary Formatter. Can you please enlighten me?

Regards

  • 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-27T05:47:07+00:00Added an answer on May 27, 2026 at 5:47 am

    Works fine here (see below). I’m happy to help, but you might want to add a reproducible example I can look at.

    using System.Collections.Generic;
    using System.Linq;
    using ProtoBuf;
    [ProtoContract]
    class Study
    {
        private readonly List<ClinicalFinding> findings
            = new List<ClinicalFinding>();
        [ProtoMember(1)]
        public List<ClinicalFinding> Findings { get { return findings; } } 
    }
    [ProtoContract]
    class ClinicalFinding
    {
        private readonly List<ScreenShot> screenShots = new List<ScreenShot>();
        [ProtoMember(1)]
        public List<ScreenShot> ScreenShots { get { return screenShots; } } 
    }
    [ProtoContract]
    class ScreenShot
    {
        [ProtoMember(1)]
        public byte[] Blob { get; set; }
    }
    static class Program
    {
        static void Main()
        {
            var study = new Study {
                Findings = {
                    new ClinicalFinding {
                        ScreenShots = {
                            new ScreenShot {Blob = new byte[] {0x01, 0x02}},
                            new ScreenShot {Blob = new byte[] {0x03, 0x04, 0x05}},
                        }
                    },
                    new ClinicalFinding {
                        ScreenShots = {
                            new ScreenShot {Blob = new byte[] {0x06, 0x07}},
                        }
                    }
                }
            };
            // the following does a serialize/deserialize
            var clone = Serializer.DeepClone(study);
    
            int sum = clone.Findings.SelectMany(x => x.ScreenShots)
                .SelectMany(x => x.Blob).Sum(x => (int) x); // 28, as expected
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started using the protobuf-net lib to communication between some of the programs
I started using EF 4.1 code first. I have a entity table like this:
I started using NHibernate this week (struggling). I have a small application with 3
I started using a 3rd party API that depends on XML-RPC.NET using CookComputing.XmlRpc; I
I started using subversion for one of my projects and it would be absolutely
I started using NetBeans for Python development, and so far it looks pretty good.
i started using nginx upload module (which creates upload files like /tmp/000121545) but i
I started using Zend_Paginator, it works everything fine but I noticed that there is
Is it possible to use protobuf-net in RESTful webservices created using WCF RESTful starter
We started using Mercurial a several weeks ago. Most developers follow this workflow: work

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.