Cry about...
MS-Windows Troubleshooting


error CS0305: Using the generic type 'System.Collections.Generic.IEnumerable<T>' requires 1 type arguments


Symptom:

When compiling the following error is generated:

error CS0305: Using the generic type 'System.Collections.Generic.IEnumerable<T>' requires 1 type arguments

where the code is using IEnumerable, such as:

var enumerableElement = element as IEnumerable;

so generics are not used.

Cause:

The file is likely using:

using System.Collections.Generic;

which provides a definition for IEnumerable<T> but not IEnumerable.

 Remedy:

Add the following using clause:

using System.Collections;

this will provide the required definition for IEnumerable.


These notes have been tested within Microsoft Visual Studio .NET 2012 (.NET 4), and may apply to other versions as well.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.