以下代码出现 4 个错误,你能告诉我如何解决这个问题吗?
1-命名空间不能直接包含字段或方法等成员2-预期的类,委托,枚举,接口或结构。3-类型或命名空间定义,或预期的文件结尾
代码为:
License Seal;
public void Mainform() {}
public MainForm() {}
public enum auth{}
}
{{
Seal = new License();
Seal.ID = "";
Seal.Catch = true;
Seal.Protection = License.Guard.FullScan;
Seal.Initialize();
}
public MainForm.cs();
}}
auth();
InitializeComponent();{
}
这是因为所有"工作"代码都必须在方法中,所有方法都必须在类中,并且类必须位于命名空间(或其他类)中。