Solved

.Net Serialization change the class name without breaking saved files

Posted on 2014-03-05
6
295 Views
Last Modified: 2014-03-05
hi
I have app with class called say "MyClass"
I want to change it to say "MyClass123"
Problem is that there are saved files that are serialized to have "MyClass"
How do I handle this - I want to rename class but still all files to open

Thanks
0
Comment
Question by:rwallacej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39906712
Creating a new class instead of renaming would be one option.
0
 

Author Comment

by:rwallacej
ID: 39906748
the saved files will have lots of
<MyClass> items

so
<MyClass123> won't be found

I need to rename class to MyClass123 BUT still be able to read serialized files with <MyClass>  
(I don't mind if the serialized files have <MyClass> in them and not newer MyClass123

reason...the original class name wasn't good / clear so want to change it
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
ID: 39906784
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 6

Assisted Solution

by:Tony O'Byrne
Tony O'Byrne earned 250 total points
ID: 39907190
The MSDN also gives examples of serializing with a specified filename.  Being able to specify the filename explicitly like this would mean you can change things as much as you want later down the road.

http://msdn.microsoft.com/en-us/library/58a18dwa(v=vs.110).aspx
0
 

Author Comment

by:rwallacej
ID: 39907325
tried

    <XmlRoot(ElementName:="xxx")> _

and

    <XmlRoot("xxx")> _

but this didn't work.
the saved files still have the class name / Filename - they don't have the <xxx> specified
0
 

Author Comment

by:rwallacej
ID: 39907396
got it thanks, I was mixing variable names and class names
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question