'For Each' on type '<typename>' is ambiguous because the type implements multiple instantiations of 'System.Collections.Generic.IEnumerable(Of T)'
Updated: July 20, 2015
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
For Each statement specifies an iterator variable that has more than one GetEnumerator method.
The iterator variable must be of a type that implements the System.Collections.IEnumerable or System.Collections.Generic.IEnumerable<T> interface in one of the
Collections namespaces of the .NET Framework. It is possible for a class to implement more than one constructed generic interface, using a different type argument for each construction. If a class that does this is used for the iterator variable, that variable has more than one GetEnumerator method. In such a case, Visual Basic cannot choose which method to call.
Error ID: BC32096
- Use DirectCast Operator or TryCast Operator to cast the iterator variable type to the interface defining the GetEnumerator method you want to use.