title: how to migrate away from ConfigurationManager in .net 6
body: <p>I am trying to migrate a legacy .net framework project to .net 6</p>
  <p>One problem is that we have a Constants class, which contains code like this:</p>
  <pre><code>public static class Constants
  {
     public static int MaxCodes = Convert.ToInt32(ConfigurationManager.AppSettings[&quot;MaxCodes&quot;] ?? &quot;250&quot;);
  }
  </code></pre>
  <p>How can I move this to .net 6? I don't think IConfiguration is Injectable in a static class, so need to change this class to a non-static one and using <code>services.AddSingleton</code>.</p>
  <p>But it means lots of code changes in the referenced code. Are there other ways to do it?</p>