I have seen this syntax in MSDN: yield break, but I don\'t know what it does. Does anyone know?
Here http://www.alteridem.net/2007/08/22/the-yield-statement-in-c/ is very good example:
public static IEnumerableRange( int min, int max ) { while ( true ) { if ( min >= max ) { yield break; } yield return min++; } }
and explanation, that if a yield break
statement is hit within a method, execution of that method stops with no return. There are some time situations, when you don't want to give any result, then you can use yield break.