【问题标题】:Expected class, delegate, enum, interface, or struct (CS1518)预期的类、委托、枚举、接口或结构 (CS1518)
【发布时间】:2016-06-24 13:15:21
【问题描述】:

这里的代码很简单,我找到的答案似乎不起作用。

我正在使用

SharpDevelop 版本:3.2.1.6466 .NET 版本:2.0.50727.5485

问题是错误代码 预期的类、委托、枚举、接口或结构 (CS1518)。

有什么想法吗?

Program.cs 代码:

using System;
using System.Threading;

namespace Threshold
{
public class Class1
{
    public Class1()
    {
        Heritage YOLO = new Heritage();
        YOLO.Fractal();
    }
}
    static void Main()
    {
       //do nothing
    }
}

它调用的cs文件是:

using System;
using System.Threading;

namespace Threshold
{
public class Heritage
{
int Fractal()
{
    //Do stuff.
}
}

internal partial class DefineConstants
{
    public const string DRIVERPATH = "d:\\tc\\bgi";
}

}

请帮忙解决。 谢谢。

【问题讨论】:

    标签: c# struct enums


    【解决方案1】:

    您的主要方法在类之外。放在里面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-08
      • 2016-04-09
      • 1970-01-01
      相关资源
      最近更新 更多