Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ Single< T >() [2/2]

static T System.Linq.ImmutableArrayExtensions.Single< T > ( this ImmutableArray< T > immutableArray,
Func< T, bool > predicate )
inlinestatic

Definition at line 284 of file ImmutableArrayExtensions.cs.

285 {
286 Requires.NotNull(predicate, "predicate");
287 bool flag = true;
288 T result = default(T);
289 T[] array = immutableArray.array;
290 foreach (T val in array)
291 {
292 if (predicate(val))
293 {
294 if (!flag)
295 {
297 }
298 flag = false;
299 result = val;
300 }
301 }
302 if (flag)
303 {
304 Enumerable.Empty<T>().Single();
305 }
306 return result;
307 }

References System.array, System.Linq.predicate, System.Single, and System.Collections.Immutable.ImmutableArray< T >.TwoElementArray.