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

  • Home
  • SEARCH
  • 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 6670625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:17:26+00:00 2026-05-26T03:17:26+00:00

I had a similar problem as the user posting at the following location: Cross-Process

  • 0

I had a similar problem as the user posting at the following location:

Cross-Process Drag and Drop of custom object type in WinForms C#

Luckily, I have figured out how to serialize almost all parts of my custom object except for a SortedList object.

I need this object because it contains some pretty crucial information to my application, and the Xml nesting is pretty messy.

When I comment out the line adding the SortedList in the ISerializable member GetObjectData(), the object makes it across to the new app. When I leave it in, it doesn’t, and I can’t figure out how to get it serialized.

I have done some looking both here on StackOverflow and on the web, but have found nothing of use.

I am using the following code to check if my object is serializable so it can be drag & dropped to another application:

    /// <summary>
    /// Determine if object can be fully serializable to binary format.
    /// </summary>
    /// <param name="obj"></param>
    /// <param name="errorMsg">If return value false, contains reason for failure.</param>
    /// <returns></returns>
    public static bool IsSerializable(object obj, out string errorMsg)
    {
        errorMsg = "";

        using (MemoryStream mem = new MemoryStream())
        {
            BinaryFormatter bin = new BinaryFormatter();
            try
            {
                bin.Serialize(mem, obj);
                return true;
            }
            catch (Exception ex)
            {
                errorMsg = string.Format("Object cannot be serialized: {0}", ex.ToString());
                return false;
            }
        }
    }

Does anyone have any suggestions that can help me out? I would like to keep my list of XmlNodes intact during the drag/drop if possible, but wouldn’t be opposed to doing some additional coding to break it up into serialize-able pieces and reconstructing it on the other side. The important thing is that the end result must contain a SortedList.

If necessary, I can provide the contents of my custom object I am serializing for drag and drop if it will help.

Thanks,

Kyle K.

  • 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-26T03:17:27+00:00Added an answer on May 26, 2026 at 3:17 am

    I finally figured out how to correctly serialize my object. I was using a SortedList of XmlNodes, which I found out the XmlNode object is not serializable. I switched my implementation to contain a SortedList of strings, and now everything works just fine.

    Thanks,

    Kyle

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

Sidebar

Related Questions

This user asked a similar question but had no viable solution in the answers,
Quick question: Is there a per-user data storage object (similar to Session ) that
I’ve got a problem and it seems some before me have had similar problems
I had a similar question answered Here There is a slight twist to the
I didn't see any similar questions asked on this topic, and I had to
I've had a bit of a search around, but couldn't find anything similar to
This is similar to the problem posted here , but that solution doesn't work
I've found a couple similar posts regarding this same problem, but none of the
OK, I had asked a similar question before and had got an answer but
Hallo All, Please help in determining the best procedure for the following problem. In

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.