Return another Enumerable within a method C# with Example



Return another Enumerable within a method C# with Example

returning Enumerable 
public IEnumerable F1() 
{ 
for (int i = 0; i < 3; i++) 
yield return i; 
//return F2(); // Compile Error!! 
foreach (var element in F2()) 
yield return element; 
} 
public int[] F2() 
{ 
return new[] { 3, 4, 5 }; 
} 
 

Dataflow Constructs 

0 Comment's

Comment Form