Should be fine (see below). Was there a specific issue you were
seeing?
Marc
using System;
using System.Collections;
using System.Collections.Generic;
struct MyTuple : IEnumerable<int>
{
public readonly int a, b, c, d, e; // lazy... should be props
public MyTuple(int a, int b, int c, int d, int e)
{
this.a = a; this.b = b; this.c = c;
this.d = d; this.e = e;
}
public IEnumerator<int> GetEnumerator()
{
yield return a;
yield return b;
yield return c;
yield return d;
yield return e;
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
static class Program
{
static void Main()
{
MyTuple tuple = new MyTuple(1, 2, 3, 4, 5);
foreach(int x in tuple) {
Console.WriteLine(x);
}
}
}