Created
January 2, 2014 19:48
-
-
Save mormegil-cz/8225412 to your computer and use it in GitHub Desktop.
Static fields and methods in interfaces in CIL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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