Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Identifier expected
You did not supply an identifier. An identifier is the name of a class, struct, namespace, method, variable, and so on, that you provide.
The following example declares a simple class but does not give the class a name:
public class //CS1001
{
public int Num { get; set; }
void MethodA() {}
}
The following sample generates CS1001 because, when declaring an enum, you must specify members:
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()
{
}
}
Parameter names are required even if the compiler doesn't use them, for example, in an interface definition. These parameters are required so that programmers who are consuming the interface know something about what the parameters mean.
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)
{
}
}