title: Setting Switch in Code
body: <p>I'm trying to embed the following switch setting in my console application but I need the app.config to not be necessary. Is there another way to set this switch within the app? </p>
  
  <p>I have come across <code>AppContext.SetSwitch</code> but this is only available in .NET 4.6, but my app will need to run on XP machines. Is there another way of doing this?</p>
  
  <pre><code>&lt;runtime&gt;
    &lt;AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" /&gt;
  &lt;/runtime&gt;
  </code></pre>