title: Performance of static properties/functions
body: <p>is there a difference in performance when making properties static/shared that were instance properties before, maybe any locking mechanisms?</p>
  
  <p>There is a heavily used object in HttpCache which was accessible through a property in a page-instance(Service.aspx). Now i wonder if it would be better to make it static because the HttpCache is shared across the application anyway.</p>
  
  <p>The main reason i decided to make it static was because it is simpler to reference(<code>Service.dsRMA</code> vs. <code>((Service)Page).dsRMA</code>).</p>
  
  <p>I'm aware of the problems that can occur regarding static functions and thread safety.</p>
  
  <p>Thank you for your time.</p>
  
  <p><strong>Before</strong>:</p>
  
  <p>C#</p>
  
  <pre><code>public ERPModel.dsRMA dsRMA {
      get {
          if (Cache("DS_RMA") == null) {
              Cache("DS_RMA") = new ERPModel.dsRMA();
          }
          return (ERPModel.dsRMA)Cache("DS_RMA");
      }
  }
  </code></pre>
  
  <p>VB</p>
  
  <pre><code>Public ReadOnly Property dsRMA() As ERPModel.dsRMA
      Get
          If Cache("DS_RMA") Is Nothing Then
              Cache("DS_RMA") = New ERPModel.dsRMA
          End If
          Return DirectCast(Cache("DS_RMA"), ERPModel.dsRMA)
      End Get
  End Property
  </code></pre>
  
  <p><strong>After</strong>:</p>
  
  <p>C#</p>
  
  <pre><code>public static ERPModel.dsRMA dsRMA {
      get {
          if (HttpContext.Current.Cache("DS_RMA") == null) {
              HttpContext.Current.Cache("DS_RMA") = new ERPModel.dsRMA();
          }
          return (ERPModel.dsRMA)HttpContext.Current.Cache("DS_RMA");
      }
  }
  </code></pre>
  
  <p>VB</p>
  
  <pre><code>Public Shared ReadOnly Property dsRMA() As ERPModel.dsRMA
      Get
          If HttpContext.Current.Cache("DS_RMA") Is Nothing Then
              HttpContext.Current.Cache("DS_RMA") = New ERPModel.dsRMA
          End If
          Return DirectCast(HttpContext.Current.Cache("DS_RMA"), ERPModel.dsRMA)
      End Get
  End Property
  </code></pre>