#endif
deleteTempFiles = (db == null || db == "no");
#if !NET_2_1
- IDictionary table = (IDictionary) ConfigurationSettings.GetConfig("system.diagnostics");
+ // DiagnosticsSection
+ ConfigurationSection table = (ConfigurationSection) ConfigurationSettings.GetConfig("system.diagnostics");
+ var bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
if (table != null)
{
- table = (IDictionary) table["switches"];
- if (table != null)
- {
- string val = (string) table ["XmlSerialization.Compilation"];
- if (val == "1") deleteTempFiles = false;
+ // SwitchElementsCollection
+ var pi = table.GetType ().GetProperty ("Switches", bf);
+ var switchesElement = (ConfigurationElementCollection) pi.GetValue (table, null);
+ foreach (ConfigurationElement e in switchesElement) {
+ // SwitchElement
+ if (e.GetType ().GetProperty ("Name", bf).GetValue (e, null) as string == "XmlSerialization.Compilation") {
+ if (e.GetType ().GetProperty ("Value", bf).GetValue (e, null) as string == "1")
+ deleteTempFiles = false;
+ break;
+ }
}
}
#endif