Guest User

Untitled

a guest
Jul 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. C#:
  2.  
  3. namespace StructTest
  4. {
  5. public struct Foo
  6. {
  7. public int x;
  8. public int y;
  9.  
  10. public Foo(int z)
  11. {
  12. x = z;
  13. y = 0;
  14. }
  15. }
  16.  
  17. public static class Bar
  18. {
  19. public static void Main(string[] args)
  20. {
  21. Foo foo = new Foo();
  22. foo.x = 0;
  23. }
  24. }
  25. }
  26.  
  27. -------------------------------------------------------------------------------------------------------
  28.  
  29. IL:
  30.  
  31. .assembly extern mscorlib
  32. {
  33. .ver 2:0:0:0
  34. .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
  35. }
  36. .assembly 'struct'
  37. {
  38. .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
  39. 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
  40. 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
  41.  
  42. .hash algorithm 0x00008004
  43. .ver 0:0:0:0
  44. }
  45. .module struct.exe // GUID = {853E4289-AEAF-4156-97DC-25BE65E70FB1}
  46.  
  47.  
  48. .namespace StructTest
  49. {
  50. .class public sequential ansi sealed beforefieldinit Foo
  51. extends [mscorlib]System.ValueType
  52. {
  53. .field public int32 x
  54. .field public int32 y
  55.  
  56. // method line 1
  57. .method public hidebysig specialname rtspecialname
  58. instance default void '.ctor' (int32 z) cil managed
  59. {
  60. // Method begins at RVA 0x20ec
  61. // Code size 15 (0xf)
  62. .maxstack 8
  63. IL_0000: ldarg.0
  64. IL_0001: ldarg.1
  65. IL_0002: stfld int32 StructTest.Foo::x
  66. IL_0007: ldarg.0
  67. IL_0008: ldc.i4.0
  68. IL_0009: stfld int32 StructTest.Foo::y
  69. IL_000e: ret
  70. } // end of method Foo::.ctor
  71.  
  72. } // end of class StructTest.Foo
  73. }
  74.  
  75. .namespace StructTest
  76. {
  77. .class public auto ansi abstract sealed beforefieldinit Bar
  78. extends [mscorlib]System.Object
  79. {
  80.  
  81. // method line 2
  82. .method public static hidebysig
  83. default void Main (string[] args) cil managed
  84. {
  85. // Method begins at RVA 0x20fc
  86. .entrypoint
  87. // Code size 17 (0x11)
  88. .maxstack 2
  89. .locals init (
  90. valuetype StructTest.Foo V_0)
  91. IL_0000: ldloca.s 0
  92. IL_0002: initobj StructTest.Foo
  93. IL_0008: ldloca.s 0
  94. IL_000a: ldc.i4.0
  95. IL_000b: stfld int32 StructTest.Foo::x
  96. IL_0010: ret
  97. } // end of method Bar::Main
  98.  
  99. } // end of class StructTest.Bar
  100. }
Add Comment
Please, Sign In to add comment