回答編集履歴
1
ミス修正
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
それがクラスだったら、taskに行っている処理と同じ処理を再帰的に行います。
|
8
8
|
|
9
|
-
それがコンテナだったら、cwtasksに行っている処理と同じ処理を行います。(
|
9
|
+
それがコンテナだったら、cwtasksに行っている処理と同じ処理を行います。(配列処理は再帰しない方が簡単と思います。型が異なるのでややこしくなりそうです。)
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -22,13 +22,13 @@
|
|
22
22
|
|
23
23
|
{
|
24
24
|
|
25
|
-
Type parentType = task.GetType();
|
26
|
-
|
27
25
|
PropertyInfo[] infos = task.GetType().GetProperties();
|
28
26
|
|
29
27
|
foreach (PropertyInfo info in infos)
|
30
28
|
|
31
29
|
{
|
30
|
+
|
31
|
+
Type type=info.PropertyType ;
|
32
32
|
|
33
33
|
if ((type.IsPrimitive) || (type == typeof(string)))
|
34
34
|
|
@@ -50,11 +50,13 @@
|
|
50
50
|
|
51
51
|
{
|
52
52
|
|
53
|
-
|
53
|
+
// 下記2行は、object member=info.GetValue(task, null);でも良いかも知れません。
|
54
54
|
|
55
|
-
|
55
|
+
Type parentType = task.GetType();
|
56
56
|
|
57
|
-
|
57
|
+
object member=parentType.InvokeMember(info.Name, BindingFlags.GetField, null, task, null);
|
58
|
+
|
59
|
+
|
58
60
|
|
59
61
|
PropertyInfo[] infos = member.GetType().GetProperties();
|
60
62
|
|