【问题标题】:A new expression Requires (), [], or {} C# Constructor Error [closed]新表达式需要 ()、[] 或 {} C# 构造函数错误 [关闭]
【发布时间】:2014-05-27 08:50:48
【问题描述】:
public class ScreenManager
{

    #region Variables
    private static List<BaseScreen> Screens = new List<BaseScreen>();
    private static List<BaseScreen> NewScreens = new List<BaseScreen>
    #endregion

    public ScreenManager()
    {

    }
 }

构造函数的“公共”部分用红色下划线表示“新表达式需要 ()、[] 或 {}”,但后面显然有 ()。

有什么解决办法吗?

【问题讨论】:

  • 你显然没有!
  • “我显然在 it 之后有 ()。” 我曾经和它在一起,但后来他们改变了 it 是什么。现在我所拥有的不是it,而it 对我来说似乎很奇怪和可怕。 © 辛普森爷爷

标签: c# syntax constructor error-handling


【解决方案1】:

基本语法错误。替换:

private static List<BaseScreen> NewScreens = new List<BaseScreen>

private static List<BaseScreen> NewScreens = new List<BaseScreen>();

【讨论】:

  • 天哪,谢谢 :D 第一次在这里发帖,你们真的很快 :D
猜你喜欢
  • 2022-01-19
  • 2010-09-28
  • 2011-12-13
  • 1970-01-01
  • 1970-01-01
  • 2017-06-17
  • 2019-06-16
  • 1970-01-01
相关资源
最近更新 更多