Skip to content
This repository has been archived by the owner on Jun 22, 2019. It is now read-only.

M_AMLEngineExtensions_ActionExtensions_FirstOrDefaultFromMany__1

AutomationML edited this page Feb 23, 2017 · 2 revisions

ActionExtensions.FirstOrDefaultFromMany(T) Method

Enumerate and call predicate on each Object in the Tree (this method performs a recursive descent ) until the predicate is true, then it returns with the found element .

Namespace: AMLEngineExtensions
Assembly: AMLEngineExtensions (in AMLEngineExtensions.dll) Version: 3.5

Syntax

C#

public static T FirstOrDefaultFromMany<T>(
	this IEnumerable<T> source,
	Func<T, IEnumerable<T>> childrenSelector,
	Predicate<T> condition
)
where T : CAEXBasicObject

C++

public:
[ExtensionAttribute]
generic<typename T>
where T : CAEXBasicObject
static T FirstOrDefaultFromMany(
	IEnumerable<T>^ source, 
	Func<T, IEnumerable<T>^>^ childrenSelector, 
	Predicate<T>^ condition
)

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(T)
The source.
childrenSelector
Type: System.Func(T, IEnumerable(T))
The children selector.
condition
Type: System.Predicate(T)
The condition.

Type Parameters

 

T
CAEX-Object-Type

Return Value

Type: T
The first CAEX-Object found, for which the test predicate gives true.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(T). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

ActionExtensions Class
AMLEngineExtensions Namespace

  • Introduction
  • [Version History](Version history)
    • [Version 3.5](Version 3.4)
    • [Version 3.1](Version 3.0)
    • [Version 2.1](Version 2.1)
    • [Version 2.0](Version 2.0)
  • [Getting Started](Getting started)
  • Examples
  • AMLEngine API
BEST Practice Content

Extensions

CAEX Elements

AutomationML

Utilities

Interfaceclasses

Exceptions

Objecttables and Document validation

Clone this wiki locally