Skip to main content
edited body
Source Link
D Stanley
  • 153.1k
  • 12
  • 189
  • 257

One problem is here:

where T : IEnumerator<T> 

You're restricting the generic class to a class that is its own enumerator.

Since FileInfo is not an IEnumerator<FileInfo> and IEnumerator<FileInfo> is not an IEnumerator<IEnumerator<FileInfo>> it fails the generic constraint.

You could add a second generic type:

private static bool CyclicalSafeMoveNext<T, U>(T Enoomerator) 
                                       where T : IEnumerator<U>

or just make IEnumerable<T>IEnumerator<T> part of the signature:

private static bool CyclicalSafeMoveNext<T>(IEnumerator<T> Enoomerator) 

One problem is here:

where T : IEnumerator<T> 

You're restricting the generic class to a class that is its own enumerator.

Since FileInfo is not an IEnumerator<FileInfo> and IEnumerator<FileInfo> is not an IEnumerator<IEnumerator<FileInfo>> it fails the generic constraint.

You could add a second generic type:

private static bool CyclicalSafeMoveNext<T, U>(T Enoomerator) 
                                       where T : IEnumerator<U>

or just make IEnumerable<T> part of the signature:

private static bool CyclicalSafeMoveNext<T>(IEnumerator<T> Enoomerator) 

One problem is here:

where T : IEnumerator<T> 

You're restricting the generic class to a class that is its own enumerator.

Since FileInfo is not an IEnumerator<FileInfo> and IEnumerator<FileInfo> is not an IEnumerator<IEnumerator<FileInfo>> it fails the generic constraint.

You could add a second generic type:

private static bool CyclicalSafeMoveNext<T, U>(T Enoomerator) 
                                       where T : IEnumerator<U>

or just make IEnumerator<T> part of the signature:

private static bool CyclicalSafeMoveNext<T>(IEnumerator<T> Enoomerator) 
Source Link
D Stanley
  • 153.1k
  • 12
  • 189
  • 257

One problem is here:

where T : IEnumerator<T> 

You're restricting the generic class to a class that is its own enumerator.

Since FileInfo is not an IEnumerator<FileInfo> and IEnumerator<FileInfo> is not an IEnumerator<IEnumerator<FileInfo>> it fails the generic constraint.

You could add a second generic type:

private static bool CyclicalSafeMoveNext<T, U>(T Enoomerator) 
                                       where T : IEnumerator<U>

or just make IEnumerable<T> part of the signature:

private static bool CyclicalSafeMoveNext<T>(IEnumerator<T> Enoomerator)