Advertisement
Guest User

Untitled

a guest
Mar 21st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <configuration>
  3.  
  4. <configSections>
  5. <sectionGroup name="ConsoleSettings">
  6. <section name="Console" type="MyApp.ConfigSection" allowLocation="true" allowDefinition="Everywhere" />
  7. </sectionGroup>
  8. </configSections>
  9.  
  10. <ConsoleSettings>
  11. <Console Username="User" Password="user" LanAddress="192.168.42.11" Port="8792" />
  12. </ConsoleSettings>
  13. ....
  14.  
  15. var configFile = new ExeConfigurationFileMap();
  16. var configFile.ExeConfigFilename = "MyApp.exe.config";
  17. var config = ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None);
  18.  
  19. var configGroup = config.SectionGroups[@"ConsoleSettings"];
  20. var consoleSection = configGroup.Sections[0];
  21. var lanAddress = consoleSection.// this is where I get stuck
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement