We're a place where coders share, stay up-to-date and grow their careers.
I saw a nice option to add a helper class with AppSettings properties so I won't have to use strings all the time
hey.. Are you saying GetSection() and use bind() to a type isn't enough? One nice solution (that some libs use) is extension methods like so:
GetSection()
bind()
public static string GetMyProperty(this IConfiguration configuration) { string result = configuration.GetValue<string>("My:Key"); return result; } // usage configuration.GetMyProperty()
I saw a nice option to add a helper class with AppSettings properties so I won't have to use strings all the time
hey.. Are you saying
GetSection()
and usebind()
to a type isn't enough? One nice solution (that some libs use) is extension methods like so: