title: "If is class" Condition Failing
body: <p>Hi I have 3 base interfaces:</p>
  <pre><code>public interface IKlarfDefect
  {
      int TEST { get; set; }
      int DEFECTID { get; set; }
  
  }
  
  public interface IKlarfDefect &lt;TImageListInfo&gt; : IKlarfDefect
  {
  
      List&lt;TImageListInfo&gt; KlarfImageList { get; set; }
  }
  
  public interface IHasKlarfImageList&lt;TImageListInfo&gt;
  {
      List&lt;TImageListInfo&gt; KlarfImageList { get; }
  }
  </code></pre>
  <p>These classes implement it:</p>
  <pre><code>public class CIMKlarfDefect : IKlarfDefect, IHasKlarfImageList&lt;CIMKlarfImageListInfo&gt;
  {
      public int TEST { get; set; }
      public int DEFECTID { get; set; }
  
      public List&lt;CIMKlarfImageListInfo&gt; KlarfImageList { get; set; } = new List&lt;CIMKlarfImageListInfo&gt;();
      
  }
  
  public class RMTKlarfDefect : IKlarfDefect, IHasKlarfImageList&lt;CIMKlarfImageListInfo&gt;
  {
      public int TEST { get; set; }
      public int DEFECTID { get; set; }
      
      public List&lt;RMTKlarfImageListInfo&gt; KlarfImageList { get; set; } = new List&lt;RMTKlarfImageListInfo&gt;();
  }
  </code></pre>
  <p>Then I have this function in another class that tries to read through these classes:</p>
  <pre><code>internal static string CreateCIMDefectListString(IEnumerable&lt;IKlarfDefect&lt;IKlarfImageListInfo&gt;&gt; klarfDefectList)
  {
      StringBuilder defectListString = new StringBuilder();
      defectListString.AppendLine(&quot;&quot;);
      foreach (var klarfDefect in klarfDefectList) { 
          defectListString.Append(klarfDefect.TEST).Append(&quot; &quot;);
          defectListString.Append(klarfDefect.DEFECTID).Append(&quot; &quot;);
          
          if (klarfDefect is IHasKlarfImageList&lt;IKlarfImageListInfo&gt; grcKlarfDefect) 
          {
              if (grcKlarfDefect.KlarfImageList.Count == 0)
              {
                  defectListString.Append(&quot;N;&quot;);
                  defectListString.AppendLine();
              }
              
          }
      }
      return defectListString.ToString();
  
  }
  </code></pre>
  <p>It compiles but the if statement fails when I am passing in either RMTKlarfDefect or CIMKlarfDefect. Might anyone know why this is?</p>
  <p>if klarfDefect is IHasKlarfImageList grcKlarfDefect
  fails as in, it doesn't return true which would allow it to process the imagelist</p>