0

I have the runtime code from IEnumerable interface below:

public partial interface IEnumerable
{
    System.Collections.IEnumerator GetEnumerator();
}

and then

public partial interface IEnumerable<out T> : System.Collections.IEnumerable
{
    new System.Collections.Generic.IEnumerator<T> GetEnumerator();
}

What is the meaning of the "new" on the second partial interface. Notice that that is an interface, there is no instance being created there because it is not an implementation, it must mean something else.

Edit: By the way the second if for generics only, the first one is the "object" IEnumerable.

Theodor Zoulias
  • 34,835
  • 7
  • 69
  • 104
RollRoll
  • 8,133
  • 20
  • 76
  • 135
  • 2
    That's the keyword used to shadow a member - meaning that this `interface` is redefining the `GetEnumerator()` of the parent `interface`. – Enigmativity Aug 30 '20 at 02:34
  • https://stackoverflow.com/questions/6583104/what-does-new-keyword-mean-when-used-inside-an-interface-in-c – Willy David Jr Aug 30 '20 at 02:34

0 Answers0