NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0156

An argumentless throw statement is not allowed outside of a catch clause

A throw statement with no parameters can only appear in a catch clause that takes no parameters.

The following sample generates CS0156:

using System;
namespace x
{
   public class b : Exception
   {
   }
   public class a
   {
      public static void Main()
      {
         try
         {
            throw;   // CS0156
         }
         catch(b)
         {
            throw;   // this throw is valid
         }
      }
   }
}

See Also

Exception Handling Statements