I am using the XMLSerializer to map the XML below to an object as
follows:
Config config
XmlSerializer xmls = new XmlSerializer( typeof( Config ) );
try {
TextReader tr = new StreamReader( "config.xml" );
config = (Config)xmls.Deserialize( tr );
tr.Close();
} catch (System.IO.FileNotFoundException) {
// How do I set up the defaults??
}
My problem is that I want to be able set my config object to defaults
if the xml file is not found. Any ideas?
David
----- XML File -----
<?xml version="1.0"?>
<Config>
<Directories>
<Directory Name="Cleaned" Location="" />
<Directory Name="Received" Location="" />
</Directories>
<Extention Default="csv" />
<Files>
<File Name="Cleaned" Location="" />
<File Name="Received" Location="" />
</Files>
<FileHistory>
<FileName></FileName>
</FileHistory>
<Filters Sorted="true">
<Filter>
<Name>All files (*.*)</Name>
<Data>*.*</Data>
</Filter>
<Filter>
<Name>Comma Separated Files (*.csv)</Name>
<Data>*.csv</Data>
<Selected/>
</Filter>
</Filters>
</Config>