AsParallel () and Any()?
问题 I've seen this code which check a condition using AsParallel() and Any() : bool IsAnyDeviceConnected() { return m_devices.Any(d => d.IsConnected); } and to make it faster : bool IsAnyDeviceConnected() { return m_devices.AsParallel().Any(d => d.IsConnected); } But looking at Any() : internal static bool Any<T>(this IEnumerable<T> source, Func<T, bool> predicate) { foreach (T element in source) { if (predicate(element)) { return true; } } return false; } I don't see ( obviously ) - that it does