Code: Select all
public IEnumerator NonYielding_Method( float foo )
{
return YieldingLazyEvaluated_Method(foo);
}
public IEnumerator YieldingLazyEvaluated_Method( float foo )
{
yield return null;
}
public void Queue( IEnumerator seq )
{
myList.Add(seq);
}
Code: Select all
public void Test()
{
Queue( YieldingLazyEvaluated_Method(1F) ); //works already, lazily evaluated
Queue( NonYielding_Method(1F) ); //i need this be denied by compiler error (due to it being eagerly evaluated and therefore instantly executed)
}