根据 Java背景,我知道接口方法不能包含接口内的代码,如下文所述(摘自rel=“nofollow”>here):
A method declaration within an interface is followed by a semicolon, but no braces, because an interface does not provide implementations for the methods declared within it.
Does this also apply for C#? As I have constructed an interface to test this in Visual Studio, and after specifying code in an interface method s body, the compiler did not stop me from doing this.