IEnumerableExtensionFirstOrNullTSource(IEnumerableTSource, FuncTSource, Boolean, Boolean) Method
Gets the first
VCardProperty from a collection of
VCardProperty
objects and allows filtering of the items, and to specify whether or not to ignore empty items.
Namespace: FolkerKinzel.VCards.ExtensionsAssembly: FolkerKinzel.VCards (in FolkerKinzel.VCards.dll) Version: 8.0.1+a91cc3f0fd39aeb548e16006a60ca9dd10a304a2
public static TSource FirstOrNull<TSource>(
this IEnumerable<TSource>? values,
Func<TSource, bool>? filter,
bool skipEmptyItems = true
)
where TSource : VCardProperty
<ExtensionAttribute>
Public Shared Function FirstOrNull(Of TSource As VCardProperty) (
values As IEnumerable(Of TSource),
filter As Func(Of TSource, Boolean),
Optional skipEmptyItems As Boolean = true
) As TSource
public:
[ExtensionAttribute]
generic<typename TSource>
where TSource : VCardProperty
static TSource FirstOrNull(
IEnumerable<TSource>^ values,
Func<TSource, bool>^ filter,
bool skipEmptyItems = true
)
[<ExtensionAttribute>]
static member FirstOrNull :
values : IEnumerable<'TSource> *
filter : Func<'TSource, bool> *
?skipEmptyItems : bool
(* Defaults:
let _skipEmptyItems = defaultArg skipEmptyItems true
*)
-> 'TSource when 'TSource : VCardProperty
- values IEnumerableTSource
- The IEnumerableT of VCardProperty
objects to search. The collection may be null, empty, or may contain null
references.
- filter FuncTSource, Boolean
- A FuncT, TResult which allows additional filtering of
the items, or null to not perform additional filtering. The arguments of the delegate
are guaranteed to not be null.
- skipEmptyItems Boolean (Optional)
- Pass false to include empty items in the return value.
("Empty" means that IsEmpty returns true.) null
values will always be ignored.
- TSource
- Generic type parameter that's constrained to be a class that's
derived from VCardProperty.
TSource
The first VCardProperty from values that passes the
filter, or null if no such item could be found. This happens
in any case
- if values is null,
- if values is empty,
- if values contains only null references,
- or if values contains only empty items and
skipEmptyItems is true.
"First" is defined as the item with the lowest Index
value. If Index is null, MaxValue
is assumed.
If no Index is specified, the first VCardProperty
that passes the filter is returned.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. 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).