【问题标题】:Invalid token error on foreach c#?foreach c#上的无效令牌错误?
【发布时间】:2014-05-30 08:53:40
【问题描述】:

这是代码有人可以告诉我我做错了什么吗? 我似乎在 foreach 语句中遇到了错误,并且我在底部的大括号中得到了预期的文件结尾,即使我添加了一个;,它仍然给我这个错误。

Activity (Label = "Songression")]   
public class results : Activity
{ public results
   {
    protected override void OnCreate (Bundle bundle);

    var cbs = this.Intent.Extras.GetBooleanArray("cbs");
    var texts = this.Intent.Extras.GetBooleanArray("texts");

    foreach (var cb in cbs)
    {
        System.Diagnostics.Debug.WriteLine (cb);

    }

    foreach (var text in texts)
    {
        System.Diagnostics.Debug.WriteLine (text);

    }


    }


}
}

【问题讨论】:

    标签: c# android compiler-errors


    【解决方案1】:

    在 C# 中此语句无效

    public results
    {
        //some code
    }
    

    我不知道你从哪里得到的。 每个成员都应该有一个单独的访问级别修饰符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-18
      • 1970-01-01
      • 1970-01-01
      • 2013-09-29
      • 2018-07-22
      • 2011-04-22
      • 2017-04-12
      • 2022-07-08
      相关资源
      最近更新 更多