title: Creating method using C# in ASP.NET with Razor syntax
body: <p><strong>Problem resolved</strong>: I found a reusable solution. Thank you everyone for your help.</p>
  
  <p>I'm frustrated and don't know what I'm doing. I'm attempting to build a webpage and one of the things I'm trying to do is cut down on code. In order to do so, I need to create a method, I know extensively about methods from Java, but not when trying to write C# in ASP.NET using razor syntax. The problem I'm facing is my @helper refuses to access the global hash table "dictionary". I've tried a lot of different things and have decided to turn to stackoverflow for help. Thanks in advance.</p>
  
  <p>UPDATES: </p>
  
  <p>Error Message is "CS0103: The name 'dictionary' does not exist in the current context"</p>
  
  <p>I need a hashtable because I'm pulling from a database, checking to see if its null, if yes, replacing it with an empty string, then pushing it to a table. So if I could learn how to do it in this fashion, it would work best, I think?</p>
  
  <pre><code>&lt;!doctype html&gt;
  
  @using System;
  @using System.Collections.Generic;
  @using System.Collections;
  @using System.Linq;
  
  @{
      var dictionary = new Dictionary&lt;string, object&gt;();
  
      dictionary.Add("fName", returnString100.FRSTNAME.Trim());
  
      @helper printOut(string toBePrinted) {
          object curValue;
          if(dictionary.TryGetValue(toBePrinted, out curValue)) { 
              return curValue; 
          }
      }
  }
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;First Name:&lt;/td&gt;&lt;td&gt;@{ printOut("fName"); }&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>