Regarding .config files
Hï!
If the "AddrColWidths" entry is missing in the config file my last code line throws an exception. Is there a common way to check if the entry exists before trying to read it?
I also wonder if there is an easy way to check wether the .config file exists, for example through the config object. I cant find such a way.
Code:
String ^exePath = Reflection::Assembly::GetExecutingAssembly()->Location;
System::Configuration::Configuration ^config =
ConfigurationManager::OpenExeConfiguration(exePath);
AppSettingsSection ^appSettingsSection =
(AppSettingsSection^)config->GetSection("appSettings");
CommaDelimitedStringCollectionConverter^ converter =
gcnew CommaDelimitedStringCollectionConverter();
CommaDelimitedStringCollection^ collection =
(CommaDelimitedStringCollection^)converter->ConvertFrom(appSettingsSection->Settings["AddrColWidths"]->Value);
Best regards
Mattias
.NET 3.5, VS 2008 Express, SQL Server 2008 Express