回答編集履歴
1
コメントを追加。
answer
CHANGED
@@ -77,11 +77,13 @@
|
|
77
77
|
// 自分もマッチしないし、子もいないのでこのインスタンスはいらない
|
78
78
|
return null;
|
79
79
|
}else {
|
80
|
+
// 子を作り直すので自身をコピー。
|
80
81
|
var result = new Person();
|
81
82
|
result.PersonName = current.PersonName;
|
82
83
|
result.PersonId = current.PersonId;
|
83
84
|
result.ParentId = current.ParentId;
|
84
85
|
result.Children = new List<Person>();
|
86
|
+
// 子について探索
|
85
87
|
foreach( var c in current.Children) {
|
86
88
|
var childResult = Search(c, v);
|
87
89
|
// 子が返ってきたらそれは必要。
|