Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryGetSingle< TSource >() [1/2]

static TSource System.Linq.Enumerable.TryGetSingle< TSource > ( this IEnumerable< TSource > source,
Func< TSource, bool > predicate,
out bool found )
inlinestaticprivate

Definition at line 7601 of file Enumerable.cs.

7602 {
7603 if (source == null)
7604 {
7605 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
7606 }
7607 if (predicate == null)
7608 {
7609 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.predicate);
7610 }
7612 {
7613 while (enumerator.MoveNext())
7614 {
7615 TSource current = enumerator.Current;
7616 if (!predicate(current))
7617 {
7618 continue;
7619 }
7620 while (enumerator.MoveNext())
7621 {
7622 if (predicate(enumerator.Current))
7623 {
7624 ThrowHelper.ThrowMoreThanOneMatchException();
7625 }
7626 }
7627 found = true;
7628 return current;
7629 }
7630 }
7631 found = false;
7632 return default(TSource);
7633 }

References System.Collections.Generic.Dictionary< TKey, TValue >.GetEnumerator(), System.Linq.predicate, System.Linq.source, System.Linq.ThrowHelper.ThrowArgumentNullException(), and System.Linq.ThrowHelper.ThrowMoreThanOneMatchException().