c# - System.Configuration Configuration Manager -


i using system.configuration in assembly implement getter/setters system.configuration link on top of code gets greyed out (for not used in assembly)

configuration & configurationmanager underlined red istead of teal color. error mesage :

the type and/or namespace name configuration not found. (are missing... etc.)

strange thing is, in test program same code runs without errors. there need change in properties or assembly system.configuration running?

thank help!

public string getappsetting(string key)     {         //load appsettings         configuration config = configurationmanager.                                 openexeconfiguration(                                 system.reflection.assembly.                                 getexecutingassembly().location);         //zurückgeben der dem key zugehörigen value         return config.appsettings.settings[key].value;     }      public void setappsetting(string key, string value)     {         //save appsettings         configuration config = configurationmanager.                                 openexeconfiguration(                                 system.reflection.assembly.                                 getexecutingassembly().location);         //Überprüfen ob key existiert         if (config.appsettings.settings[key] != null)         {             //key existiert. löschen des keys zum "überschreiben"             config.appsettings.settings.remove(key);         }         //anlegen eines neuen keyvalue-paars         config.appsettings.settings.add(key, value);         //speichern der aktualisierten appsettings         config.save(configurationsavemode.modified); } 

you need add reference system.configuration assembly.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -