Reputation: 739
I have a function that returns a tuple made up of two objects of the same class.
class MyClass
{
public int i;
public char c;
};
Now, I have a function that returns IEnumerable
public IEnumerable<Tuple<MyClass, MyClass>> Func1()
{
.....
.....
yield return Tuple.Create(MyClassObj1, MyClassObj2);
}
And I have one more function that access this tuple as a parameter.
public void Func2(Tuple<MyClass, MyClass> Pair)
{
//here I can access Pair.Item1 and Pair.Item2 but not Pair.Item1.i or Pair.Item2.c
}
Now, how do I access the member elements of the objects MyClassObj1 and MyClassObj2 inside Func2?
Upvotes: 0
Views: 783
Reputation: 54764
how do i access the member elements of the objects MyClassObj1 and MyClassObj2 inside Func2?
Make them The compiler error message should give some clues.public
in the declaration of MyClass
.
Upvotes: 4