I don't understand why the EnsureLocalDisposalRule is flagging some of
my code.
Here's one of my routines as an example:
public static IEnumerable<T> ReplaceSelected<T>(
this IEnumerable<T> source,
Predicate<T> selector,
Converter<T, T> replacment)
{
foreach(var item in source)
{
if (selector(item))
{
yield return replacment(item);
}
else
{
yield return item;
}
}
}
It's my understanding that foreach guarantees the disposal of the
Enumerator after use (see
http://msdn.microsoft.com/en-us/library/aa288257(VS.71).aspx
for one statement of this).
Am I missing anything here, or is this a false positive from
EnsureLocalDisposalRule?
Thanks,
Bevan.