.Net Serialization change the class name without breaking saved files

rwallacej
rwallacej used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014

Commented:
Creating a new class instead of renaming would be one option.

Author

Commented:
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
Most Valuable Expert 2012
Top Expert 2014
Commented:
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Tony O'ByrneSenior Web Developer
Commented:
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

Author

Commented:
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

Author

Commented:
got it thanks, I was mixing variable names and class names

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial