コード例 #1
0
        private StructureModel FindStructure(int structureId, ObservableCollection <StructureModel> subStructures)
        {
            StructureModel result = null;

            foreach (var item in subStructures)
            {
                if (item.Id == structureId)
                {
                    return(item);
                }
                if (item.SubStructures.Count > 0)
                {
                    result = FindStructure(structureId, item.SubStructures);
                    if (result != null)
                    {
                        break;
                    }
                }
            }
            return(result);
        }