EnumerableExtensionsGetSameOrDefaultT, S Method |
Gets the same element if all elements of the enumeration (after a transformation) are the same. If the elements in the enumeration are different, the return value is null or default.
Namespace: Altaxo.CollectionsAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3448.0 (4.8.3448.0)
Syntaxpublic static S GetSameOrDefault<T, S>(
this IEnumerable<T> seq,
Func<T, S> transform
)
Parameters
- seq IEnumerableT
- The enumeration.
- transform FuncT, S
- The transformation function that converts the elements of the enumeration to a comparable value.
Type Parameters
- T
- Type of the enumeration.
- S
- Type of the comparable value. Type T is transformed to type S before comparison.
Return Value
SThe element if all elements of the enumeration are the same. If the elements in the enumeration are different, the return value is null or default.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. 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