BuildingCoder.CmdCollectorPerformance.GetFirstNamedElementOfTypeUsingExplicitCode C# (CSharp) Метод

GetFirstNamedElementOfTypeUsingExplicitCode() приватный Метод

Return the first element of the given type and name using explicit code.
private GetFirstNamedElementOfTypeUsingExplicitCode ( Type type, string name ) : Element
type Type
name string
Результат Element
        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;
        }