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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:52:52+00:00 2026-06-14T08:52:52+00:00

I am making modifications to a legacy app which uses XmlSerializer to serialize/deserialize XML

  • 0

I am making modifications to a legacy app which uses XmlSerializer to serialize/deserialize XML files into a class. The requirement is to change a certain property in the new app version, so that old files can be loaded like before, but an upgraded (more general) property should be persisted next time. The old property would then be ditched on next save.

To explain it a bit better, this is how the file looks:

<Data>
   <ImportantAnalysisResults>
        <ImportantAnalysisResult>...</ImportantAnalysisResult>
        <ImportantAnalysisResult>...</ImportantAnalysisResult>
        <ImportantAnalysisResult>...</ImportantAnalysisResult>
   </ImportantAnalysisResults>
</Data>

New app version should load the file properly, and replace the element name with the new one on next save:

<Data>
   <Results>
        <Result>...</Result>
        <Result>...</Result>
        <Result>...</Result>
   </Results>
</Data>

The <Data> element has many more properties, but this is one that needs to be changed. Also, ImportantAnalysisResult inherits from Result.

In my Data class, I tried doing something like this:

class Data 
{ 
    [Obsolete("Used for backward compatibility. Use Results instead.")]
    [XmlArrayItem("ImportantAnalysisResult", typeof(Result))]
    public List<Result> ImportantAnalysisResults
    {
        get { return _results; }
    }

    public List<Result> Results 
    {
        get { return _results; }
    }
}

But this would still save the old property back into the new file. What’s the best way to make ImportantAnalysisResults disappear on next save?

Is there a way to simply “map” the old property to the new Results property while loading?

  • 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-06-14T08:52:53+00:00Added an answer on June 14, 2026 at 8:52 am

    One way of doing this is using XmlAttributeOverrides. It helps you to overrides xml serialization. Hope it helps.

    XmlAttributeOverrides xmlAttributeOverrides = new XmlAttributeOverrides();
    
    //Add overrides to xmlAttributeOverrides, use sample from internet
    
    XmlSerializer serializer = new XmlSerializer(typeof(Data), XmlAttributeOverrides);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making some modifications to an iPad app written by somebody else and
After making some major modifications to a Rails app that is already in production,
I'm making modifications to the Android 4.0 launcher and I have been running into
I've been tasked with making some significant modifications to a legacy codebase that was
After making a few modifications to a rails app I am tinkering on, railroad
I am making modifications to elements on UI. There is no (extra) thread or
I am making some modifications to a website, but it is hosted by a
Making an adobe flex ui in which data that is calculated must use proprietary
Just some pointers here. I am making fairly extensive modifications to a site, including
I am working on someone else's code and making significant modifications. (I am converting

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.