?
Solved

.Net Serialization change the class name without breaking saved files

Posted on 2014-03-05
6
Medium Priority
?
302 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 1000 total points
ID: 39906784
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Assisted Solution

by:Tony O'Byrne
Tony O'Byrne earned 1000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

762 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