public void AddComplexObject(IDataListVerifyPart part) { var paths = part.DisplayValue.Split('.'); IComplexObjectItemModel itemModel = null; for (var index = 0; index < paths.Length; index++) { var path = paths[index]; if (string.IsNullOrEmpty(path) || char.IsNumber(path[0])) { return; } path = DataListUtil.ReplaceRecordsetIndexWithBlank(path); var pathToMatch = path.Replace("@", ""); if (string.IsNullOrEmpty(pathToMatch) || pathToMatch == "()") { return; } var isArray = DataListUtil.IsArray(ref path); if (itemModel == null) { itemModel = _vm.ComplexObjectCollection.FirstOrDefault( model => model.DisplayName == pathToMatch && model.IsArray == isArray); if (itemModel != null) { continue; } itemModel = new ComplexObjectItemModel(path) { IsArray = isArray }; _vm.ComplexObjectCollection.Add(itemModel); } else { if (index == 0) { continue; } var item = itemModel.Children.FirstOrDefault( model => model.DisplayName == pathToMatch && model.IsArray == isArray); if (item == null) { item = new ComplexObjectItemModel(path) { Parent = itemModel, IsArray = isArray }; itemModel.Children.Add(item); } itemModel = item; } } }