R
Rene
Hi.
Before I start, I would like to point out that in order for you to follow my
question you may need to use Reflector.
Ok, so here is the deal. I was messing around with Reflector checking out
some code when I stumbled across a class called
"OrderedEnumerable<TElement>".
If you look at the class using Reflector, you will notice that the class
contains a nested class called "<GetEnumerator>d_0". If you in turn, look at
this "<GetEnumerator>d_0" class, you will notice that it implements the
"IEnumerator" interface.
Now, I realize that most people are well aware of what methods the
"IEnumerator" interface implements but I will list them here anyway:
public interface IEnumerator
{
bool MoveNext();
object Current { get; }
void Reset();
}
Notice how the "IEnumerator" requires the implementation of the "MoveNext()"
method.
Now if you don't mind, I would like you to look at the "<GetEnumerator>d_0"
class and tell me where is this "MoveNext()" method implemented is such a
way so that it satisfies the requirements of implementing the "IEnumerator"
interface.
You will notice that there is a "MoveNext()" method implement but its
implemented a *private* and as far as I was aware of, the implementation
should be *public* or *explicit* in order for the compiler to allow this to
compile.
So why did the complier allowed this to happen? What am I missing? Something
tells me that is going to be something very obvious and it's a stupid
question but I just can't see what's going on!
Thanks for your help.
Before I start, I would like to point out that in order for you to follow my
question you may need to use Reflector.
Ok, so here is the deal. I was messing around with Reflector checking out
some code when I stumbled across a class called
"OrderedEnumerable<TElement>".
If you look at the class using Reflector, you will notice that the class
contains a nested class called "<GetEnumerator>d_0". If you in turn, look at
this "<GetEnumerator>d_0" class, you will notice that it implements the
"IEnumerator" interface.
Now, I realize that most people are well aware of what methods the
"IEnumerator" interface implements but I will list them here anyway:
public interface IEnumerator
{
bool MoveNext();
object Current { get; }
void Reset();
}
Notice how the "IEnumerator" requires the implementation of the "MoveNext()"
method.
Now if you don't mind, I would like you to look at the "<GetEnumerator>d_0"
class and tell me where is this "MoveNext()" method implemented is such a
way so that it satisfies the requirements of implementing the "IEnumerator"
interface.
You will notice that there is a "MoveNext()" method implement but its
implemented a *private* and as far as I was aware of, the implementation
should be *public* or *explicit* in order for the compiler to allow this to
compile.
So why did the complier allowed this to happen? What am I missing? Something
tells me that is going to be something very obvious and it's a stupid
question but I just can't see what's going on!
Thanks for your help.