title: C# Assign Name for Try-Catch Error
body: <p>Everybody use <a href="http://msdn.microsoft.com/en-us/library/0yd65esw.aspx" rel="nofollow">Try-Catch</a> in C#. I know that.</p>
  
  <p>For Example;</p>
  
  <pre><code>static void Main()
      {
          string s = null; // For demonstration purposes.
  
          try
          {            
              ProcessString(s);
          }
  
          catch (Exception e)
          {
              Console.WriteLine("{0} Exception caught.", e);
          }
      }
  }
  </code></pre>
  
  <p>Everything is OK.</p>
  
  <p>But how can i assign name for spesific error?</p>
  
  <p>For Example;</p>
  
  <pre><code>try
  {
     enter username;
     enter E-Mail;
  }
  catch
  {
  
  }
  </code></pre>
  
  <ul>
  <li>IF username is already exist, <code>ErrorMessage</code>--> ("The Username Already Exist")</li>
  <li>IF E-Mail is already exist, <code>ErrorMessage</code> --> ("E-Mail is using")</li>
  </ul>
  
  <p>How can i do that in <code>C#</code>?</p>
  
  <p>Best Regards, </p>
  
  <p>Soner</p>