// // Copyright(c) 2019 SimonG. All Rights Reserved.
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
namespaceLightweightIocContainer
{
internalstaticclassEnumerableExtension
{
/// <summary>
/// Returns the first element of a <see cref="IEnumerable{T}"/>, or a new instance of a given <see cref="Type"/> if the <see cref="IEnumerable{T}"/> contains no elements
/// </summary>
/// <typeparam name="TSource">The source <see cref="Type"/> of the <see cref="IEnumerable{T}"/></typeparam>
/// <typeparam name="TGiven">The given <see cref="Type"/> to return if the <see cref="IEnumerable{T}"/> contains no elements</typeparam>
/// <param name="source">The given <see cref="IEnumerable{T}"/></param>
/// <returns>The first element of the <see cref="IEnumerable{T}"/>, or a new instance of a given <see cref="Type"/> if the <see cref="IEnumerable{T}"/> contains no elements</returns>
/// Returns the first element of a <see cref="IEnumerable{T}"/> that satisfies a condition, or a new instance of a given <see cref="Type"/> if no such element is found
/// </summary>
/// <typeparam name="TSource">The source <see cref="Type"/> of the <see cref="IEnumerable{T}"/></typeparam>
/// <typeparam name="TGiven">The given <see cref="Type"/> to return if the <see cref="IEnumerable{T}"/> contains no element that satisfies the given condition</typeparam>
/// <param name="source">The given <see cref="IEnumerable{T}"/></param>
/// <param name="predicate">A function to test each element for a condition</param>
/// <returns>The first element of the <see cref="IEnumerable{T}"/> that satisfies a condition, or a new instance of the given <see cref="Type"/> if no such element is found</returns>
/// Tries to get the first element of the given <see cref="IEnumerable{T}"/> or creates a new element of a given <see cref="Type"/> when no element is found
/// </summary>
/// <typeparam name="TSource">The source <see cref="Type"/> of the <see cref="IEnumerable{T}"/></typeparam>
/// <typeparam name="TGiven">The given <see cref="Type"/> to create a new element when no fitting element is found</typeparam>
/// <param name="source">The given <see cref="IEnumerable{T}"/></param>
/// <param name="predicate">A function to test each element for a condition</param>
/// <returns>The first element of the <see cref="IEnumerable{T}"/> or a new instance of the given <see cref="Type"/> when no element is found</returns>
Returns the first element of a <seecref="T:System.Collections.Generic.IEnumerable`1"/>, or a new instance of a given <seecref="T:System.Type"/> if the <seecref="T:System.Collections.Generic.IEnumerable`1"/> contains no elements
</summary>
<typeparamname="TSource">The source <seecref="T:System.Type"/> of the <seecref="T:System.Collections.Generic.IEnumerable`1"/></typeparam>
<typeparamname="TGiven">The given <seecref="T:System.Type"/> to return if the <seecref="T:System.Collections.Generic.IEnumerable`1"/> contains no elements</typeparam>
<paramname="source">The given <seecref="T:System.Collections.Generic.IEnumerable`1"/></param>
<returns>The first element of the <seecref="T:System.Collections.Generic.IEnumerable`1"/>, or a new instance of a given <seecref="T:System.Type"/> if the <seecref="T:System.Collections.Generic.IEnumerable`1"/> contains no elements</returns>
Returns the first element of a <seecref="T:System.Collections.Generic.IEnumerable`1"/> that satisfies a condition, or a new instance of a given <seecref="T:System.Type"/> if no such element is found
</summary>
<typeparamname="TSource">The source <seecref="T:System.Type"/> of the <seecref="T:System.Collections.Generic.IEnumerable`1"/></typeparam>
<typeparamname="TGiven">The given <seecref="T:System.Type"/> to return if the <seecref="T:System.Collections.Generic.IEnumerable`1"/> contains no element that satisfies the given condition</typeparam>
<paramname="source">The given <seecref="T:System.Collections.Generic.IEnumerable`1"/></param>
<paramname="predicate">A function to test each element for a condition</param>
<returns>The first element of the <seecref="T:System.Collections.Generic.IEnumerable`1"/> that satisfies a condition, or a new instance of the given <seecref="T:System.Type"/> if no such element is found</returns>
Tries to get the first element of the given <seecref="T:System.Collections.Generic.IEnumerable`1"/> or creates a new element of a given <seecref="T:System.Type"/> when no element is found
</summary>
<typeparamname="TSource">The source <seecref="T:System.Type"/> of the <seecref="T:System.Collections.Generic.IEnumerable`1"/></typeparam>
<typeparamname="TGiven">The given <seecref="T:System.Type"/> to create a new element when no fitting element is found</typeparam>
<paramname="source">The given <seecref="T:System.Collections.Generic.IEnumerable`1"/></param>
<paramname="predicate">A function to test each element for a condition</param>
<returns>The first element of the <seecref="T:System.Collections.Generic.IEnumerable`1"/> or a new instance of the given <seecref="T:System.Type"/> when no element is found</returns>
The Lifestyles that can be used for a <seecref="T:LightweightIocContainer.Interfaces.Registrations.IDefaultRegistration`1"/>
@ -507,5 +541,12 @@
<exceptioncref="T:LightweightIocContainer.Exceptions.InvalidFactoryRegistrationException">Factory registration is invalid</exception>
<exceptioncref="T:LightweightIocContainer.Exceptions.IllegalAbstractMethodCreationException">Creation of abstract methods are illegal in their current state</exception>