"Yield Return and Break"

public IEnumerable<int> GetOneTwoThree(bool includeNegative = false) {
	yield return 1;
	yield return 2;
	yield return 3;
	if (!includeNegative) yield break;
	yield return -1;
	yield return -2;
	yield return -3;
}

// ..

Console.WriteLine(String.Join(",", GetOneTwoThree())); // Prints "1,2,3" on console
Console.WriteLine(String.Join(",", GetOneTwoThree(true))); // Prints "1,2,3,-1,-2,-3" on console


Code snippet taken from "Complete C# Quick Reference - C# 2, 3 and 4".