编译器错误 CS1001

应输入标识符

没有提供标识符。 标识符是所提供的类、结构、命名空间、方法、变量等的名称。

以下示例声明一个简单的类,但没有为类指定名称:

public class //CS1001
{
    public int Num { get; set; }
    void MethodA() {}
}

下面示例生成 CS1001,因为声明枚举时,必须指定成员:

public class Program
{
    enum Colors
    {
        'a', 'b' // CS1001, 'a' is not a valid int identifier
        // The following line shows examples of valid identifiers:
        // Blue, Red, Orange
    };

    public static void Main()
    {
    }
}

即使编译器不使用参数名(例如,在接口定义中),也需要参数名。 这些参数是必需的,这样,使用接口的程序员就会知道一些参数的含义。

interface IMyTest
{
    void TestFunc1(int, int);  // CS1001
    // Use the following line instead:
    // void TestFunc1(int a, int b);
}

class CMyTest : IMyTest
{
    void IMyTest.TestFunc1(int a, int b)
    {
    }
}

另请参阅