Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to read values from appsettings.json in c#

There are two methods to retrieve our values,

string dbConn = configuration.GetSection("MySettings").GetSection("DbConnection").Value;

string dbConn2 = configuration.GetValue<string>("MySettings:DbConnection");  

 
PREVIOUS NEXT
Tagged: #read #values
ADD COMMENT
Topic
Name
8+7 =