質問編集履歴

1

「街頭のソースコード」のTestクラスを修正しました。

2021/10/16 06:35

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,8 @@
12
12
 
13
13
  手元にビルドの環境がなく、雰囲気だけのコードですが記述してみました。
14
14
 
15
+ (実際の今のコードは自動実装プロパティが定義されているだけで、INotifyPropertyChangedなどは実装されていません。同期をとる処理を試すために修正したものが以下です。)
16
+
15
17
 
16
18
 
17
19
  ```cs
@@ -126,11 +128,25 @@
126
128
 
127
129
  {
128
130
 
131
+ public void TestMethod()
132
+
133
+ {
134
+
129
- var class0 = new Class0();
135
+ var class0 = new Class0();
130
-
136
+
131
- class0.PropertyClass1.PropertyClass11.PropertyInt1 = 10;
137
+ class0.PropertyClass1.PropertyClass11.PropertyInt1 = 10;
132
-
138
+
133
- // class0.PropertyClass2.PropertyClass21.PropertyInt2 == 20;
139
+ // class0.PropertyClass2.PropertyClass21.PropertyInt2 == 20;
140
+
141
+
142
+
143
+ class0.PropertyClass1.PropertyClass11 = new Class11();
144
+
145
+ class0.PropertyClass1.PropertyClass11.PropertyInt1 = 30;
146
+
147
+ // class0.PropertyClass2.PropertyClass21.PropertyInt2 == 60; // ← イベントが発生しないため60にはならない
148
+
149
+ }
134
150
 
135
151
  }
136
152