回答編集履歴

1

member1の書き換え処理を追加

2020/03/18 11:55

投稿

takeaship
takeaship

スコア129

test CHANGED
@@ -33,6 +33,14 @@
33
33
  .GetField("s", BindingFlags.Instance | BindingFlags.NonPublic)
34
34
 
35
35
  .GetValue(classInstance);
36
+
37
+ Console.WriteLine(structInstance);
38
+
39
+ structInstance.GetType()
40
+
41
+ .GetField("member1", BindingFlags.Instance | BindingFlags.Public)
42
+
43
+ .SetValue(structInstance, false);
36
44
 
37
45
  Console.WriteLine(structInstance);
38
46
 
@@ -80,4 +88,6 @@
80
88
 
81
89
  member1: True, member2: False
82
90
 
91
+ member1: False, member2: False
92
+
83
93
  ```