简体   繁体   English

命名空间不能直接包含字段或方法等成员。

[英]A namespace cannot directly contain members such as fields or methods.

So I get the error: 所以我得到错误:

A namespace cannot directly contain members such as fields or methods. 命名空间不能直接包含字段或方法等成员。

I double click it and it takes me to the line case: 1002 我双击它,它带我到行case: 1002

     #region Vip Seller
            case 1002:
               {
                    switch (npcRequest.OptionID)
                    {
                        case 0:
                            {
                                if (client.Entity.VIPLevel == 6)
                                {
                                    dialog.Text("your Are already VIP 6.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                    break;
                                }
                                dialog.Text("Hay i will upgrade your VIP for cps");
                                dialog.Option("[VIP 1] 20k cps.", 1);
                                dialog.Option("[VIP 2] 20k cps.", 2);
                                dialog.Option("[VIP 3] 15k cps.", 3);
                                dialog.Option("[VIP 4] 30k cps.", 4);
                                dialog.Option("[VIP 5] 15k cps.", 5);
                                dialog.Option("[VIP 6] 20k cps.", 6);
                                dialog.Option("Just passing by.", 255);
                                dialog.Avatar(116);
                                dialog.Send();
                                break;

                            }
                        case 1:
                            {
                                if (client.Entity.VIPLevel == 0 && client.Entity.VIPLevel < 1)
                                {
                                    if (client.Entity.ConquerPoints >= 20000)
                                    {
                                        client.Entity.ConquerPoints -= 20000;
                                        client.Entity.VIPLevel = 1;

                                    }

                                    else
                                    {
                                        dialog.Text("Please take 20k cps.");
                                        dialog.Option("I see.", 255);
                                        dialog.Avatar(116);
                                        dialog.Send();
                                    }

                                }
                                else
                                {
                                    dialog.Text("Sorry Can't upgrade any more.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                }

                                break;
                            }
                        case 2:
                            {
                                if (client.Entity.VIPLevel == 1)
                                {
                                    if (client.Entity.ConquerPoints >= 20000)
                                    {
                                        client.Entity.ConquerPoints -= 20000;
                                        client.Entity.VIPLevel = 2;
                                    }

                                    else
                                    {
                                        dialog.Text("Please take 20k cps.");
                                        dialog.Option("I see.", 255);
                                        dialog.Avatar(116);
                                        dialog.Send();
                                    }


                                }
                                else
                                {
                                    dialog.Text("Sorry Can't upgrade any more.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                }
                                break;
                            }
                        case 3:
                            {
                                if (client.Entity.VIPLevel == 2)
                                {
                                    if (client.Entity.ConquerPoints >= 15000)
                                    {
                                        client.Entity.ConquerPoints -= 15000;
                                        client.Entity.VIPLevel = 3;
                                    }

                                    else
                                    {
                                        dialog.Text("Please take 15k cps.");
                                        dialog.Option("I see.", 255);
                                        dialog.Avatar(116);
                                        dialog.Send();
                                    }


                                }
                                else
                                {
                                    dialog.Text("Sorry Can't upgrade any more.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                }
                                break;
                            }
                        case 4:
                            {
                                if (client.Entity.VIPLevel == 3)
                                {
                                    if (client.Entity.ConquerPoints >= 30000)
                                    {
                                        client.Entity.ConquerPoints -= 30000;
                                        client.Entity.VIPLevel = 4;
                                    }

                                    else
                                    {
                                        dialog.Text("Please take 150k cps.");
                                        dialog.Option("I see.", 255);
                                        dialog.Avatar(116);
                                        dialog.Send();
                                    }

                                }
                                else
                                {
                                    dialog.Text("Sorry Can't upgrade any more.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                }
                                break;
                            }
                        case 5:
                            {
                                if (client.Entity.VIPLevel == 4)
                                {
                                    if (client.Entity.ConquerPoints >= 15000)
                                    {
                                        client.Entity.ConquerPoints -= 15000;
                                        client.Entity.VIPLevel = 5;
                                    }

                                    else
                                    {
                                        dialog.Text("Please take 15k cps.");
                                        dialog.Option("I see.", 255);
                                        dialog.Avatar(116);
                                        dialog.Send();

                                    }

                                }
                                else
                                {
                                    dialog.Text("Sorry Can't upgrade any more.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                }
                                break;
                            }
                        case 6:
                            {
                                if (client.Entity.VIPLevel == 5)
                                {
                                    if (client.Entity.ConquerPoints >= 20000)
                                    {
                                        client.Entity.ConquerPoints -= 20000;
                                        client.Entity.VIPLevel = 6;
                                    }

                                    else
                                    {
                                        dialog.Text("Please take 20k cps.");
                                        dialog.Option("I see.", 255);
                                        dialog.Avatar(116);
                                        dialog.Send();

                                    }

                                }
                                else
                                {
                                    dialog.Text("Sorry Can't upgrade any more.");
                                    dialog.Option("I see.", 255);
                                    dialog.Avatar(116);
                                    dialog.Send();
                                }
                                break;
                            }
                    }
                    break;
                }
            #endregion

Any suggestions on how to fix? 有关如何修复的任何建议?

Well, a case statement should be inside a function definition so my guess is you are missing a closing brace somewhere and this block of code appears to be inside a namespace. 好吧,case语句应该在函数定义中,所以我猜你在某个地方缺少一个右括号,这个代码块似乎在命名空间内。 (By the way the level of indentation here is troubling...) (顺便说一句,这里的缩进程度令人不安......)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 命名空间不能直接包含成员,如字段或方法? - A namespace cannot directly contain members such as fields or methods? 错误:名称空间不能直接包含诸如字段或方法之类的成员 - Error: A namespace cannot directly contain members such as fields or methods “名称空间不能直接包含诸如字段或方法之类的成员” File:具有上下文的控制器 - “A namespace cannot directly contain members such as fields or methods” File: controller with context C#名称空间不能直接包含诸如void的字段或方法之类的成员 - C# A namespace cannot directly contain members such as fields or methods for void C# 错误:“命名空间不能直接包含字段或方法等成员” - C# Error: "A namespace cannot directly contain members such as fields or methods" Unity报错:命名空间不能直接包含字段或方法等成员 - Unity error message: A namespace cannot directly contain members such as fields or methods 错误4名称空间不能直接包含成员,例如字段或方法 - Error 4 A namespace cannot directly contain members such as fields or methods c#名称空间不能直接包含成员,例如字段或方法 - c# a namespace cannot directly contain members such as fields or methods Blazor 组件:命名空间不能直接包含字段、方法或语句等成员 - Blazor components: A namespace cannot directly contain members such as fields, methods or statements 错误“名称空间不能直接包含字段或方法之类的成员”是什么意思? - What does error “A namespace cannot directly contain members such as fields or methods” mean?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM