public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
FilteredElementCollector collector
= new FilteredElementCollector( doc );
collector.OfClass( typeof( FamilyInstance ) );
List<InstanceData> instanceDataList
= new List<InstanceData>();
foreach( Element e in collector )
{
instanceDataList.Add(
new InstanceData( e ) );
}
string s = "value1";
bool b = true;
int i = 42;
var found = from instance in instanceDataList where
(instance.Param1.Equals( s )
&& b == instance.Param2
&& i < instance.Param3)
select instance;
foreach( InstanceData instance in found )
{
// Do whatever you would like
}
return Result.Failed;
}