Skip to content

Instantly share code, notes, and snippets.

@dsibinski
Last active August 30, 2021 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsibinski/99a2559ef72c2f493a231dc13879b4ec to your computer and use it in GitHub Desktop.
Save dsibinski/99a2559ef72c2f493a231dc13879b4ec to your computer and use it in GitHub Desktop.
class MyObject
{
public int Value { get; set; }
}
class MyObjectEnumerator
{
public bool MoveNext()
{
throw new NotImplementedException();
}
public MyObject Current { get; }
}
class MyCollection
{
public MyObjectEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
}
public class Tests
{
[Test]
public void ForEachTest()
{
var myCollection = new MyCollection();
foreach (var element in myCollection)
{
// foreach loop works fine :)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment