Skip to content

Instantly share code, notes, and snippets.

@binki
Created October 13, 2017 17:08
Show Gist options
  • Save binki/7d99fa49465257670733e91ed94dcaa7 to your computer and use it in GitHub Desktop.
Save binki/7d99fa49465257670733e91ed94dcaa7 to your computer and use it in GitHub Desktop.
disposing IEnumerator not allowed
1>------ Build started: Project: Disposable, Configuration: Debug Any CPU ------
1>c:\users\ohnob\AppData\Local\Temp\Disposable\Disposable\Program.cs(13,16,13,59): error CS1674: 'IEnumerator': type used in a using statement must be implicitly convertible to 'System.IDisposable'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
using System.Collections;
class Program
{
static void Main(string[] args)
{
IEnumerable enumerable = new[]
{
"a",
"b",
"c",
};
using (var enumerator = enumerable.GetEnumerator())
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment