C
C#2y ago
VicXaulim

Get values and sections from app.config

How do I get the values ​​from the .NET Framework app.config or web.config file?
10 Replies
Andrew
Andrew2y ago
How to: Read application settings - .NET Framework
Learn how to read application settings from an app.config file in .NET Framework.
Andrew
Andrew2y ago
Stack Overflow
Reading settings from app.config or web.config in .NET
I'm working on a C# class library that needs to be able to read settings from the web.config or app.config file (depending on whether the DLL is referenced from an ASP.NET web application or a Wind...
VicXaulim
VicXaulimOP2y ago
oh thanks, im trying to setup this in my lib
Andrew
Andrew2y ago
yea, lib is a bit more complex but there is a section in the docs about them
VicXaulim
VicXaulimOP2y ago
yeah, that's why I feel like I need help, basically I want to make a global configuration so that when I instantiate an object from the main class of my lib it gets the information from the .config
Andrew
Andrew2y ago
is that information provided by users of the library, or by the library?
VicXaulim
VicXaulimOP2y ago
by the users
Andrew
Andrew2y ago
they can add it to their app.config if you're comfortable with that otherwise something like this:
mplement a custom section type that extends the ConfigurationSection class. Keep a separate configuration file for your class library, and then reference the library's configuration file from the client app's configuration file. For more information, see How to: Create Custom Configuration Sections Using ConfigurationSection.
VicXaulim
VicXaulimOP2y ago
I'll give it a read Any difficulties, can I post here?
Andrew
Andrew2y ago
absolutely

Did you find this page helpful?