简体   繁体   中英

Errors in C# Namespace, expected class, and end-of file expected

I'm getting 4 errors with the following code, can you tell me how to fix this?

1- A namespace cannot directly contain members such as fields or methods 2- Expected class, delegate, enum, interface, or struct. 3- Type or namespace definition, or end-of-file expected

The code is:

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();{

 }

这是因为您所有的“工作”代码都必须在一个方法内,所有方法都必须在一个类内,并且一个类必须位于命名空间(或其他类)内。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM