title: using a variable outside of a function C#
body: <p>I would like to create a variable which uses another variable outside of a function, like this:</p>
  
  <pre><code>private void tb_TextChanged(object sender, TextChangedEventArgs e)
  {
    ...
  }
  
  TextStyle txtstyle = new TextStyle(new SolidBrush(Color.Red), null, FontStyle.Regular); // the variable
  
  private void tb_VisibleRangeChangedDelayed(object sender, EventArgs e)
  {
    ...
  }
  </code></pre>
  
  <p>I want to replace Color.Red in txtstyle with a custom color which is in the applications setting. How can I achieve this?</p>