title: CS1003 Syntax error, 'when' expected
body: <p>Its been quite some time that I read about Exception filters in C# 6.0</p>
  
  <p>I was to trying to use it in action. But not sure why I am getting the below error.</p>
  
  <blockquote>
    <p>CS1003    Syntax error, 'when' expected   C_6.0</p>
  </blockquote>
  
  <p>This is how my snippet looks like</p>
  
  <pre><code>using System;
  using static System.Console;
  
  namespace C_6._0
  {
  public class Program
  {
      static void Main(string[] args)
      {
          int val = 1;
          try
          {
              WriteLine("Enter value :");
              val = int.Parse(ReadLine());
  
          }
          catch (Exception ex) if (val == 0)
          {
              WriteLine("Input Invalid");
          }
          catch (Exception ex)
          {
              WriteLine(ex.Message);
          }
          ReadLine();
      }
   }}
  </code></pre>
  
  <p>I checked the version of C#, its 6.0 in my visual studio by </p>
  
  <p>Properties -> Build -> Advanced Build Settings </p>
  
  <p>Thanks.</p>