P
P
ProblemBook.NET
Search…
⌃K
P
P
ProblemBook.NET
Search…
⌃K
ProblemBook.NET
LANGS
Задачник.NET
Math
Oop
ValueTypes
Strings
Linq
«QueryAfterRemove» (Решение)
«ClosureAndVariable» (Решение)
«QueryAfterRemove» (Задача)
«ClosureAndVariable» (Задача)
«EnumerableToArray» (Решение)
«QueryWithInc» (Решение)
«EnumerableToArray» (Задача)
«QueryWithInc» (Задача)
«LifeAfterYield» (Решение)
“YieldExceptionYield” (Решение)
«LifeAfterYield» (Задача)
«ExceptionYieldYield» (Решение)
«ClosureAndForeach» (Решение)
«TryYieldFinally» (Задача)
«ClosureAndFor» (Решение)
«ExceptionYieldYield» (Задача)
«YieldExceptionYield» (Решение)
«ClosureAndForeach» (Задача)
«ClosureAndFor» (Задача)
«YieldExceptionYield» (Задача)
Multithreading
Summary
Введение
ProblemBook.NET
Attribution-NonCommercial-NoDerivatives 4.0 International
Powered By GitBook

«YieldExceptionYield» (Задача)

В какой момент произойдёт Exception?
public static IEnumerable<int> GetSmallNumbers()
{
yield return 1;
throw new Exception();
yield return 2;
}
void Main()
{
var numbers = GetSmallNumbers();
var evenNumbers = numbers.Select(n => n * 2);
Console.WriteLine(evenNumbers.FirstOrDefault());
}
​Решение​
Previous
«ClosureAndFor» (Задача)
Next
Multithreading
Last modified 3yr ago
Copy link