1. compiler error cs1527
Updated: February 1, November 2007
Error Message
Elements defined in the namespace cannot be explicitly declared as private, protected, or protected internal.
The type declaration in the namespace can have public or internal access. If no accessibility is specified, the default value is internal.
The following example generates cs1527:
CopyCode
// Cs1527.cs
Namespace sample
{
Private Class C1 {}; // cs1527
Protected Class C2 {}; // cs1527
Protected internal Class C3 {}; // cs1527
}
2. compiler error cs1597
Updated: February 1, November 2007
Error Message
The semicolon following the method or access block is invalid.
You do not need to (or are not allowed) Use a semicolon to end the method or access the block.
The following example generates cs1597:
Copy code
// Cs1597.cs
Class testclass
{
Public static void main ()
{
}; // Cs1597, remove semicolon
}
----------------------------------------
However, you can end the class and namespace with a semicolon.
For example:
Class testclass
{
Public static void main ()
{
}
};
3. compiler error cs0542
Updated: February 1, November 2007
Error Message
"User-defined type": the member names cannot be the same as their closed type
A name is used multiple times in the same constructor.The cause of this error may be that the returned type is put in the constructor due to negligence. (That is to say, the constructor cannot have a return type.)
The following example generates cs0542:
Copy code
// Cs0542.cs
Class F
{
// Remove void from F () to resolve the problem.
Void F () // cs0542, same name as the class
{
}
}
Class myclass
{
Public static void main ()
{
}
} If your class is named "item" and an index is declared as this, you may encounter this error. In the issued Code, the default indexer name is
"Item", resulting in a conflict.
Copy code
// Cs0542b. CS
Class item
{
Public int this [int I] // cs0542
{
Get
{
Return 0;
}
}
}
Class cmain
{
Public static void main ()
{
}
}
To be continued ......