Generates partial interface members inside the type that implements the interface.
[MemberGenerator.GenerateDefaultMembers]
public interface IDefaultInterface
{
public void Foo() => Console.WriteLine("Foo");
public int Bar() => 42;
}So when implementing the interface
public partial struct MyStruct : IDefaultInterface;Will generate the following partial type
public partial struct MyStruct
{
public void Foo() => Console.WriteLine("Foo");
public int Bar() => 42;
}The type that implements the interface must be partial, otherwise nothing will be generated.
Default interface members cannot be called directly from the type that implements the interface, as it requires the instance to be cast to the interface type.
Additionally, if you do this in struct, it can cause it to be boxed.