From a898b162b2623c629919de3f391906e1f36ea588 Mon Sep 17 00:00:00 2001 From: Petr Kulikov Date: Sat, 24 Nov 2018 00:36:09 +0100 Subject: [PATCH 1/3] Update cs0116.md --- docs/csharp/language-reference/compiler-messages/cs0116.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/language-reference/compiler-messages/cs0116.md b/docs/csharp/language-reference/compiler-messages/cs0116.md index fd826f051af4f..b9075686e3b0d 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0116.md +++ b/docs/csharp/language-reference/compiler-messages/cs0116.md @@ -11,7 +11,7 @@ ms.assetid: 4cb137b5-ec29-4c1a-adde-9f8424cb9496 A namespace does not 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). + Inside a [namespace](../keywords/namespace.md), the compiler only accepts another namespaces, classes, structures, 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). ## Example From e7c2353fe674379922ff2e6190abd1dbac550995 Mon Sep 17 00:00:00 2001 From: Petr Kulikov Date: Sat, 24 Nov 2018 11:37:03 +0100 Subject: [PATCH 2/3] Addressed feedback --- docs/csharp/language-reference/compiler-messages/cs0116.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/language-reference/compiler-messages/cs0116.md b/docs/csharp/language-reference/compiler-messages/cs0116.md index b9075686e3b0d..25b921224e639 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0116.md +++ b/docs/csharp/language-reference/compiler-messages/cs0116.md @@ -11,7 +11,7 @@ ms.assetid: 4cb137b5-ec29-4c1a-adde-9f8424cb9496 A namespace does not directly contain members such as fields or methods - Inside a [namespace](../keywords/namespace.md), the compiler only accepts another namespaces, classes, structures, 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). + Inside a [namespace](../keywords/namespace.md), the compiler only accepts namespaces, classes, structures, 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). ## Example From 5af3ede19bda606d8db5d8a795d3136ff064890d Mon Sep 17 00:00:00 2001 From: Petr Kulikov Date: Sat, 24 Nov 2018 18:04:37 +0100 Subject: [PATCH 3/3] Addressed feedback --- .../csharp/language-reference/compiler-messages/cs0116.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/csharp/language-reference/compiler-messages/cs0116.md b/docs/csharp/language-reference/compiler-messages/cs0116.md index 25b921224e639..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](../keywords/namespace.md), the compiler only accepts namespaces, classes, structures, 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)