title: Calling Extension Method to new Class
body: <p>I am new to ASP.NET MVC and even newer to Extension Methods.</p>
  
  <p>I have an extension Method I wrote </p>
  
  <pre><code>public static string ExtensionMethod(this Extension extype)
      {
          switch (extype)
          {
              case Extension.ONE:
                  return "Object one string";
  
              case Extension.TWO:
                  return "Object two string ";
  
              case Extension.THREE:
                  return "Object three string";
  
              default:
                  return "Any other string";
          }
      }
  </code></pre>
  
  <p>So basically what this does is compare selections that have been made in the view and changes the label to match what they selected.  Easy Peasy.<br>
  Now they want their reciept to reflect that exact string. So I have a class that manages my e-mails but I can't figure out how to put the value in the class.</p>
  
  <p>in my view I call </p>
  
  <pre><code>@Model.ViewModelReference.Extension();
  </code></pre>
  
  <p>this brings it in great, but I have no idea how to reference an extension class in another class</p>
  
  <pre><code>email.To = receiptInfo.EmailAddress;
  email.From = "email address";
  email.Subject = "Reciept";
              var bodyFormat = new StringBuilder();
              bodyFormat.AppendLine("*RECEIPT*\t");
              bodyFormat.AppendLine("I want Object string to show up here");
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thank you.  I implemented it like this </p>
  
  <pre><code>bodyFormat.AppendLine(MyNameSpace.MyExtension.Extension());
  </code></pre>
  
  <p>but I am getting an argument error, and I am not 100% sure which argument I should put in it, or it it even needs one.  If I don't add the () it throws a cannot convert to string error. through logic I put in extype but it doesn't like that either, says it doesn't exist in the current context.</p>