Joining multiple IEnumerable lists with different types

Joining multiple IEnumerable lists with different types

atis.sed
Advocate Advocate
234 Views
1 Reply
Message 1 of 2

Joining multiple IEnumerable lists with different types

atis.sed
Advocate
Advocate

Hi,

is it possible to join multiple IEnumerable lists with different types so later I can loop through joined list?

 

 

public IEnumerable<WallType> FindWallTypes(Document doc)
{
                FilteredElementCollector collector = new FilteredElementCollector(doc);
                IEnumerable<WallType> BasicWalls = collector
                    .OfClass(typeof(WallType))
                    .Cast<WallType>()
                    .Where(w => w.Kind == WallKind.Basic);
                return BasicWalls;
            }

IEnumerable<WallType> all_wall_types = FindWallTypes(doc);
IEnumerable<FloorType> all_floor_types = FindFloorTypes(doc);
IEnumerable<RoofType> all_roof_types = FindRoofTypes(doc);

var list = Concatenate(all_wall_types, all_floor_types, all_roof_types);

foreach (var e in list)
{
string OldName = e.Name; 
CompoundStructure FamilyCS = e.GetCompoundStructure() as CompoundStructure;
}

 

 

0 Likes
Accepted solutions (1)
235 Views
1 Reply
Reply (1)
Message 2 of 2

sahin.ikbal
Advocate
Advocate
Accepted solution

Yes.
Just take add range all of them in List<object>.

0 Likes