Skip to content

Instantly share code, notes, and snippets.

@takeshik
Created December 31, 2011 12:37
Show Gist options
  • Save takeshik/1543892 to your computer and use it in GitHub Desktop.
Save takeshik/1543892 to your computer and use it in GitHub Desktop.
Enumerable.Range(0, 10)
.Concat(EnumerableEx.Throw<int>(new DivideByZeroException()))
.ForEach(Console.WriteLine);
Enumerable.Range(0, 10)
.Concat(EnumerableEx.Throw<int>(new DivideByZeroException()))
.Catch((DivideByZeroException ex) => EnumerableEx.Return(-1))
.ForEach(Console.WriteLine);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment