diff --git a/docs/csharp/language-reference/compiler-messages/cs0116.md b/docs/csharp/language-reference/compiler-messages/cs0116.md index fd826f051af4f..4ecf0e2140e62 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0116.md +++ b/docs/csharp/language-reference/compiler-messages/cs0116.md @@ -9,9 +9,11 @@ ms.assetid: 4cb137b5-ec29-4c1a-adde-9f8424cb9496 --- # Compiler Error CS0116 -A namespace does not directly contain members such as fields or methods +A namespace cannot directly contain members such as fields or methods - Inside a [namespace](../../../csharp/language-reference/keywords/namespace.md), the compiler only accepts classes, structures, unions, enumerations, interfaces, and delegates. This error is often generated by developers from a C/C++ background who forget that in C#, methods and variables must be declared and defined within a struct or class. For more information, see [General Structure of a C# Program](../../../csharp/programming-guide/inside-a-program/general-structure-of-a-csharp-program.md). +A namespace can contain only other namespaces and type declarations. For more information, see the [namespace keyword](../keywords/namespace.md) article. + +This error is often generated by developers from a C/C++ background who forget that in C#, methods and variables must be declared and defined within a struct or class. ## Example @@ -40,7 +42,7 @@ namespace x } ``` -## See Also +## See also - [General Structure of a C# Program](../../../csharp/programming-guide/inside-a-program/general-structure-of-a-csharp-program.md) - [Classes and Structs](../../../csharp/programming-guide/classes-and-structs/index.md)