how to serialize complex object to configuration file. (.Net Framework 2.0)

  • Thread starter Thread starter Umut Tezduyar
  • Start date Start date
U

Umut Tezduyar

When I use my custom configuration file, I can't serialize complex object
using "ConfigurationProperty" or "ConfigurationCollection" attribute. There
will be one property in my custom configuration section. Whenever I set that
property, configuration will serialize it using XmlSerializer and adds to my
custom section at the configuration file.

To be more clear, is there a way to use raw xml when you are using
configuration file other than the default one?
 
You can use an XML file...

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
 
Hello Kevin,

Thanks for your reply. Instead of using XML file I want to use,
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();

fileMap.ExeConfigFilename = "FactorySettings.config";


Configuration config =
System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap,
ConfigurationUserLevel.None);



I want to take the section using config.GetSections("foo") and serialize my
custom type to that section. How can I do it, do you have any idea?
 
I want to take the section using config.GetSections("foo") and serialize
my custom type to that section. How can I do it, do you have any idea?

I'm afraid I don't. I'm not sure it's possible.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
 
Back
Top