Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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