Public interface IEnumerator < out T >: IEnumerator generic interface inherits the original interface?

when I saw the iterator on the Internet, I found it strange that the interface in C-sharp can inherit the original interface?
Link: https://referencesource.micro.

  public interface IEnumerator<out T> : IDisposable, IEnumerator
    {    
        // Returns the current element of the enumeration. The returned value is
        // undefined before the first call to MoveNext and following a
        // call to MoveNext that returned false. Multiple calls to
        // GetCurrent with no intervening calls to MoveNext 
        // will return the same object.
        // 
        /// <include file="doc\IEnumerator.uex" path="docs/doc[@for="IEnumerator.Current"]/*" />
        new T Current {
            get; 
        }
    }
Sep.08,2021

IEnumerator < out T > and IEnumerator are two completely different interfaces, and although they look the same in spelling, the signatures are not the same.

  • IEnumerator contains three members: bool MoveNext (); , Object Current {get;} , void Reset ();
  • IEnumerator < out T > contains a member: new T Current {get;}

this means that when implementing IEnumerator < out T > , you need to implement MoveNext () and Reset () methods and two versions of Current {get;} : one returns T and the other returns Object . Of course, you can reuse the code when implementing these two versions.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b40647-2c517.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b40647-2c517.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?