In C#, yield return defines an iterator sequence whose elements are produced on demand. The method body does not execute until enumeration begins, making apparent constant-time construction potentially misleading. section 6.2.4
Recursive permutation generation uses yield return to emit each change incrementally. Enumerating those results still performs the nested work: the example reaches worst-case O(n²) time because each element can trigger up to n nested calls. section 6.2.4
Lazy recursive generation
A recursive Changes method yields an empty sequence at its base case, then yields each permutation formed by inserting the next value. A foreach loop over Changes(4) enumerates the resulting sequence one change at a time.









