📜  命名空间不能直接包含字段或方法等成员 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:03.293000             🧑  作者: Mango

代码示例1
This is how you can CAUSE the error:

namespace MyNameSpace
{
   int i; <-- THIS NEEDS TO BE INSIDE THE CLASS

   class MyClass
   {
      ...
   }
}

If you don't immediately see what is "outside" the class,
this may be due to misplaced or extra closing bracket(s) }.