<VB.NET>
Function FindFamilyType_Door_v1(ByVal doorFamilyName As String, ByVal doorTypeName As String) As Element
'' narrow
down the collection with class and category.
Dim doorFamilyCollector1 = New FilteredElementCollector(m_rvtDoc)
doorFamilyCollector1.OfClass(GetType(FamilySymbol))
doorFamilyCollector1.OfCategory(BuiltInCategory.OST_Doors)
'' parse the collection for the given name using LINQ query here.
Dim doorTypeElems = _
From element In doorFamilyCollector1 _
Where element.Name.Equals(doorTypeName) And _
element.Parameter(BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM). _
AsString.Equals(doorFamilyName) _
Select element
'' get the
result.
Dim doorType1 As Element = Nothing
Dim doorTypeList As IList(Of Element) =
doorTypeElems.ToList()
If doorTypeList.Count > 0 Then '' we should
have only one.
doorType1 = doorTypeList(0) ' found it.
End If
Return doorType1
End Function
</VB.NET>