I have the following code in a .Net6 console application.
internal class Program
{
static void Main(string[] args)
{
var x = new SomethingUser<Something>();
var y = new SomethingUser<ISomething>();
Console.WriteLine(x is ISomethingUser<Something>);
Console.WriteLine(y is ISomethingUser<ISomething>);
Console.WriteLine(x is SomethingUser<ISomething>);
Console.WriteLine(y is SomethingUser<ISomething>);
Console.Read();
}
}
public class Something : ISomething {}
public class SomethingUser<T> : ISomethingUser {}
public interface ISomething {}
public interface ISomethingUser<T> {}
}
The actual output is: True, True, False, True
Can someone explain why the is check evaluates to false for the third scenario please?
I expected the output to be: True, True, True, True