Coming from a Java background, I’m aware that an interface’s method cannot contain code within the interface, as is described below (taken from 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.
Nope. Interfaces can only outline methods and properties in c#. Method bodies, or implementations are not allowed. Paste some code perhaps for a closer look at the issue.