C
C#11mo 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
lycian
lycian11mo ago
How to: Read application settings - .NET Framework
Learn how to read application settings from an app.config file in .NET Framework.
lycian
lycian11mo 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
VicXaulimOP11mo ago
oh thanks, im trying to setup this in my lib
lycian
lycian11mo ago
yea, lib is a bit more complex but there is a section in the docs about them
VicXaulim
VicXaulimOP11mo 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
lycian
lycian11mo ago
is that information provided by users of the library, or by the library?
VicXaulim
VicXaulimOP11mo ago
by the users
lycian
lycian11mo 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
VicXaulimOP11mo ago
I'll give it a read Any difficulties, can I post here?
lycian
lycian11mo ago
absolutely
Want results from more Discord servers?
Add your server