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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:26:59+00:00 2026-05-29T10:26:59+00:00

I need to serialize complex objects in my project and put them in a

  • 0

I need to serialize complex objects in my project and put them in a database. I’d like to serialize them using XML for obtain a easier debugging of my application.

My case is very similar to what is described in this article: http://geekswithblogs.net/SoftwareDoneRight/archive/2008/01/16/how-to-serialize-an-interface-using-the-xmlserializer.aspx

So I have an object containing a Property which type is defined by an interface. Then I have different concrete types implementing it.

Following the article approach, using the XmlInclude attribute, I obtain a strong coupled solution, but my application is structured to use a plug-in approach, so I could have so many implementations as I want of my interface.

Is there a way to solve my issue using xml serialization, or I have to go with binary serialization?

  • 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-29T10:27:00+00:00Added an answer on May 29, 2026 at 10:27 am

    Read your post from geekswithblogs.net. I will suggest you to do the binary serialization. It is easy to implement and to maintain (unless and until you change the qualified name of the class). Binary Serializer serializes private members too.

    How to use binary serializer

    /// <summary>
    /// Serializes the given object to byte stream
    /// </summary>
    public sealed class Serializer {
        /// <summary>
        /// Serializes the given object to byte stream
        /// </summary>
        /// <param name="objectToSeralize">Object to be serialized</param>
        /// <returns>byte array of searialize object</returns>
        public static byte[] Serialize(object objectToSeralize) {
            byte[] objectBytes;
            using (MemoryStream stream = new MemoryStream()) {
                //Creating binary formatter to serialize object.
                BinaryFormatter formatter = new BinaryFormatter();
    
                //Serializing objectToSeralize. 
                formatter.Serialize(stream, objectToSeralize);
                objectBytes = stream.ToArray();
            }
            return objectBytes;
        }
        /// <summary>
        /// De-Serialize the byte array to object
        /// </summary>
        /// <param name="arrayToDeSerialize">Byte array of Serialize object</param>
        /// <returns>De-Serialize object</returns>
        public static object DeSerialize(byte[] arrayToDeSerialize) {
            object serializedObject;
            using (MemoryStream stream = new MemoryStream(arrayToDeSerialize)) {
                //Creating binary formatter to De-Serialize string.
                BinaryFormatter formatter = new BinaryFormatter();
    
                //De-Serializing.
                serializedObject = formatter.Deserialize(stream);
            }
            return serializedObject;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need to serialize AS3 strong typed Objects, send them to a C# Application
I need to serialize/de-serialize some objects into/from string and transfer them as just opaque
I need to read and serialize objects from and to XML, Apple's .plist format
I need to serialize objects to XML in C#. The objects should be wrapped
In my web application I often need to serialize objects as JSON. Not all
I need to serialize a huge amount of data (around 2gigs) of small objects
I have a business class which I need to serialize to xml. It has
I have a complex Clojure data structure that I would like to serialize -
I need to serialize / deserialize a datetime into yyyyMMdd format for an XML
I need to serialize and deserialize an object that contains an System.Uri property using

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.