LinqGen
LinqGen copied to clipboard
the `IDisposable` local enumerator haven't properly disposed after enumerating
expect to call Dispose on local enumerator in a try-finally block, like below
public bool Any(Func<global::Foo, bool> predicate)
{
var copy = this;
global::System.Collections.Generic.IEnumerator<global::Foo> enumerator_sn0QN1 = default;
enumerator_sn0QN1 = copy.source_sn0QN1.GetEnumerator();
try
{
while (enumerator_sn0QN1.MoveNext())
{
var current_sn0QN1 = enumerator_sn0QN1.Current;
if (predicate.Invoke(current_sn0QN1))
return true;
}
return false;
}
finally
{
enumerator_sn0QN1.Dispose();
}
}