Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C#:
- namespace StructTest
- {
- public struct Foo
- {
- public int x;
- public int y;
- public Foo(int z)
- {
- x = z;
- y = 0;
- }
- }
- public static class Bar
- {
- public static void Main(string[] args)
- {
- Foo foo = new Foo();
- foo.x = 0;
- }
- }
- }
- -------------------------------------------------------------------------------------------------------
- IL:
- .assembly extern mscorlib
- {
- .ver 2:0:0:0
- .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
- }
- .assembly 'struct'
- {
- .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
- 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
- 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
- .hash algorithm 0x00008004
- .ver 0:0:0:0
- }
- .module struct.exe // GUID = {853E4289-AEAF-4156-97DC-25BE65E70FB1}
- .namespace StructTest
- {
- .class public sequential ansi sealed beforefieldinit Foo
- extends [mscorlib]System.ValueType
- {
- .field public int32 x
- .field public int32 y
- // method line 1
- .method public hidebysig specialname rtspecialname
- instance default void '.ctor' (int32 z) cil managed
- {
- // Method begins at RVA 0x20ec
- // Code size 15 (0xf)
- .maxstack 8
- IL_0000: ldarg.0
- IL_0001: ldarg.1
- IL_0002: stfld int32 StructTest.Foo::x
- IL_0007: ldarg.0
- IL_0008: ldc.i4.0
- IL_0009: stfld int32 StructTest.Foo::y
- IL_000e: ret
- } // end of method Foo::.ctor
- } // end of class StructTest.Foo
- }
- .namespace StructTest
- {
- .class public auto ansi abstract sealed beforefieldinit Bar
- extends [mscorlib]System.Object
- {
- // method line 2
- .method public static hidebysig
- default void Main (string[] args) cil managed
- {
- // Method begins at RVA 0x20fc
- .entrypoint
- // Code size 17 (0x11)
- .maxstack 2
- .locals init (
- valuetype StructTest.Foo V_0)
- IL_0000: ldloca.s 0
- IL_0002: initobj StructTest.Foo
- IL_0008: ldloca.s 0
- IL_000a: ldc.i4.0
- IL_000b: stfld int32 StructTest.Foo::x
- IL_0010: ret
- } // end of method Bar::Main
- } // end of class StructTest.Bar
- }
Add Comment
Please, Sign In to add comment