Compiler Error CS7003

Unexpected use of an unbound generic name

This error occurs if you use a generic type needing one parameter type without passing any generic parameter type name between the angle brackets. This use may be a variable declaration, or an object instantiation.

Example

The following example generates CS7003:

// CS7003.cs
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var myDictionary = new Dictionary< , >();  //CS7003

        List<> var2;                               //CS7003
    }
}

To correct this error

Provide the expected parameter type names in angle brackets, separated by commas, when using a generic type.

The previous example could be fixed as follows :

// CS7003-fixed.cs
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var myDictionary = new Dictionary<int, string>();

        List<string> var2;
    }
}

See also