Skip to content

Instantly share code, notes, and snippets.

@mormegil-cz
Created January 2, 2014 19:48
Show Gist options
  • Save mormegil-cz/8225412 to your computer and use it in GitHub Desktop.
Save mormegil-cz/8225412 to your computer and use it in GitHub Desktop.
Static fields and methods in interfaces in CIL
// test at http://www.compileonline.com/compile_ilasm_online.php
.assembly IntrfTest {}
.assembly extern mscorlib {}
.method static void Main()
{
.entrypoint
.maxstack 1
call void IInterface::StaticMethod()
call void IInterface::StaticMethod()
call void IInterface::StaticMethod()
ret
}
.class public interface IInterface {
.method public virtual abstract instance int32 Method() {
}
.method public static void StaticMethod() {
ldstr "Inside IInterface.StaticMethod: "
call void [mscorlib]System.Console::Write(string)
ldsfld int32 IInterface::Counter
ldc.i4.1
add
dup
stsfld int32 IInterface::Counter
call void [mscorlib]System.Console::WriteLine(int32)
ret
}
.field public static int32 Counter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment