public readonly struct MyStruct : IInterface
{
public MyStruct()
{
M();
}
public void Test()
{
throw new NotImplementedException();
}
}
public interface IInterface
{
static void M()
{
Console.WriteLine("IA.M");
}
void Test();
}
When I compile in visual studio 2022 with .net 7.0, I get "The name 'M' does not exist in the current context" error. To my limited knowledge, structs can implement interfaces, interfaces can have default methods .. so why the compilation error?
I'm expecting it not to give a compilation error.