Exemplo n.º 1
0
 /// <summary>Returns the first element for which the given function returns true. Returns the default value if no such element exists, or the input stream is empty.</summary>
 /// <param name="predicate">A function to test each source element for a condition.</param>
 /// <param name="stream">The input parallel stream.</param>
 /// <returns>The first element for which the predicate returns true, or the default value if no such element exists or the input parallel stream is empty.</returns>
 public static T FirstOrDefault <T>(this ParStream <T> stream, Func <T, bool> predicate)
 {
     return(stream.Where(predicate).FirstOrDefault());
 }