What are some restrictions to using yield?

  • A yield return statement can't be located in a try-catch block.
  • A yield return statement can be located in the try block of a try-finally statement.
  • A yield break statement can be located in a try block or a catch block but not a finally block.


No comments:

Post a Comment