Click here to Skip to main content
15,896,726 members

Save/Load Class data from multiply classes and inherited classes.

Jackie00100 asked:

Open original thread
Hi everyone, so i recently read about XML and saving data from classes and load it back in, but all examples I've seen only focus on single classes with no interfaces or inherited classes, so I'm alittle confused about how i can do this en a easy way.

My program have 1 abstract super class that have multiple child classes and child-child classes, I'll try to make a class diagram here below:

Superclass --> FirstChild --> SecondChild
Superclass --> ThirdChild
SomeRandomConstantClass (to hold some Items needed by FirstChild)

Everyone of them is putted in a list of super classes (to be able to have everything in one place) but i now wanna know how i i simply can save every data to a single XML and then load it back into the list/classes when clicking a load button?

As I said I've seen it on a single class how to do it with single items, but not with multiple items and inheritance so it would be awesome if some people could provide some useful sample code or articles on how to.

Thanks - Jackie
Tags: C#, XML, .NET, ASP.NET, Stream, Inheritance

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900