Element GetFirstNamedElementOfTypeUsingExplicitCode(
Type type,
string name)
{
FilteredElementCollector a
= GetElementsOfType( type );
// explicit iteration and manual checking of a property:
Element ret = null;
foreach( Element e in a )
{
if( e.Name.Equals( name ) )
{
ret = e;
break;
}
}
return ret;
}