C
C#5mo 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
lycian5mo ago
How to: Read application settings - .NET Framework
Learn how to read application settings from an app.config file in .NET Framework.
lycian
lycian5mo 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
VicXaulim5mo ago
oh thanks, im trying to setup this in my lib
lycian
lycian5mo ago
yea, lib is a bit more complex but there is a section in the docs about them
VicXaulim
VicXaulim5mo 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
lycian5mo ago
is that information provided by users of the library, or by the library?
VicXaulim
VicXaulim5mo ago
by the users
lycian
lycian5mo 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
VicXaulim5mo ago
I'll give it a read Any difficulties, can I post here?
lycian
lycian5mo ago
absolutely
Want results from more Discord servers?
Add your server
More Posts
Recursive method and memory problemsI am implementing the DFS algorithm and I am keeping track of what routes have been passed and theirIn my code, it says I have a null parameter, this is my first bit of code, Where am I going wrong?My first code ever. using Azure; using Azure.AI.OpenAI; using System; using static System.EnvironmeGraph API - HttpClient returns 404, but curl (and Graph Explorer) for same request works?I'm completely lost. I've resorted to just calling curl from C# as this is completely non-sensical tSFTP through a proxy serverI'm using SSH.NET and since I'm unable to connect to production servers directly, I have to first SSMerging 2 projects c# formsIm running into an issue with combining 2 projects in visual studio 2022. I need to combine those 2 Problem with a Vehicle CatalogueI am trying to solve a problem where i need to create something like a vehicle catalogue it works foIs there any way to *conditionally* set a property with EF `.ExecuteUpdateAsync()`?Right now, I'm doing ```cs var thing = await _ctx.Things.FirstOrDefaultAsync(t => t.Id == req.Id); iStupid question about Visual StudioHello everyone, I feel like I'm losing my mind with Microsoft Visual Studio. My college wants me to Can't withdraw and save new balance to databaseHey can someone help me with my issues I've been stuck on for hours? I am trying to make a withdraw ✅ RPC not available on trying to read a Excel workbook using interopI was trying to use `Microsoft.Office.Interop.Excel` to open a excel file and read its content. but