title: Generic return type in C#
body: <p>Was practicing Generics. Consider a stack method below. What is the best way of doing error checking other than throwing exceptions in a generic method. What if I want to return some result in this method.</p>
  
  <pre><code>public T pop()
  {
      if (top &gt;= 0)
          return arr[top--];
      return -1 or null;
  }
  </code></pre>