BuildingCoder.CmdCollectorPerformance.GetFirstNamedElementOfTypeUsingAnonymousMethod C# (CSharp) Method

GetFirstNamedElementOfTypeUsingAnonymousMethod() private method

Return the first element of the given type and name using an anonymous method.
private GetFirstNamedElementOfTypeUsingAnonymousMethod ( Type type, string name ) : Element
type Type
name string
return Element
        Element GetFirstNamedElementOfTypeUsingAnonymousMethod(
            Type type,
            string name)
        {
            FilteredElementCollector a
            = GetElementsOfType( type );

              // using an anonymous method:

              return a.First<Element>(
            e => e.Name.Equals( name ) );
        }