public void SampleChildren(IfcObject objIfc, Action <List <string> > collectionSampler) { List <IfcRelDecomposes> decomposed = objIfc.IsDecomposedBy.ToList(); if (decomposed == null || decomposed.Count == 0) { return; } List <string> collection = new List <string> { objIfc.GetType().Name }; foreach (var dec in decomposed) { foreach (var obj in dec.RelatedObjects) { collection.Add(obj.GetType().Name); if (typeof(IfcSpatialStructureElement).IsAssignableFrom(obj.GetType())) { SampleSpatialStructure((IfcSpatialStructureElement)obj, collectionSampler); } else { //do nothing ? actually, later try to figure out what these objs are } } } collectionSampler.Invoke(collection); }