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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for