A
Arjen
Hello,
Can somebody help me a little bit?
I can't get it to work.
Please see my code below... I have placed some comments like "// And whats
next?".
I'm sure that I have to code something here. But what?
What do I want?
- Serialize and deserialize ObjectsA and ObjectsB.
Thanks!
Arjen
namespace ProgramMainName {
class ProgramMainName {
public static Hashtable ObjectsA = new Hashtable();
public static Hashtable ObjectsB = new Hashtable();
/// <summary>
/// The main!
/// </summary>
[STAThread]
static void Main(string[] args) {
// To do something, like: XMLSerialization.Open()
}
}
}
namespace ProgramMainName {
public class XMLSerialization {
public static void Open() {
XmlSerializer x = new XmlSerializer( typeof( ProgramMainName ) );
FileStream fs = null;
try {
fs = new FileStream( "data.xml", FileMode.Open );
XmlReader reader = new XmlTextReader( fs );
ProgramMainName programMainName = (ProgramMainName) x.Deserialize(
reader );
// And whats next?
}
catch( FileNotFoundException ) {
}
finally {
if ( fs != null )
fs.Close();
}
}
}
public static void Save() {
// And whats next?
}
}
Can somebody help me a little bit?
I can't get it to work.
Please see my code below... I have placed some comments like "// And whats
next?".
I'm sure that I have to code something here. But what?
What do I want?
- Serialize and deserialize ObjectsA and ObjectsB.
Thanks!
Arjen
namespace ProgramMainName {
class ProgramMainName {
public static Hashtable ObjectsA = new Hashtable();
public static Hashtable ObjectsB = new Hashtable();
/// <summary>
/// The main!
/// </summary>
[STAThread]
static void Main(string[] args) {
// To do something, like: XMLSerialization.Open()
}
}
}
namespace ProgramMainName {
public class XMLSerialization {
public static void Open() {
XmlSerializer x = new XmlSerializer( typeof( ProgramMainName ) );
FileStream fs = null;
try {
fs = new FileStream( "data.xml", FileMode.Open );
XmlReader reader = new XmlTextReader( fs );
ProgramMainName programMainName = (ProgramMainName) x.Deserialize(
reader );
// And whats next?
}
catch( FileNotFoundException ) {
}
finally {
if ( fs != null )
fs.Close();
}
}
}
public static void Save() {
// And whats next?
}
}