我拼命想用一个非常简单的C#程序来利用混乱(在MonoDevelop IDE中)来证明功能,但我不熟悉C#约定。我是否需要构造一个混乱对象然后引用它?我在我的图书馆中不正确地宣布了吗? Clutter应该是我的命名空间而不是HelloWorld吗?任何帮助将不胜感激。
using System;
using Clutter;
namespace HelloWorld {
public class HelloWorld {
public int Main () {
// Init declaration produces error:
// Expression denotes a 'type', where a 'method group' was expected
Clutter.Init ();
Stage stage = Stage.Default;
stage.Color = new Clutter.Color (0, 0, 0, 255);
stage.SetSize (512, 512);
stage.Show ();
// Main declaration produces error:
// Expression denotes a 'type', where a 'method group' was expected
Clutter.Main ();
return 0;
}
}
}
答案 0 :(得分:0)
我假设 Clutter 是 Clutter 命名空间中的一个类
using System;
using Clutter;
namespace HelloWorld {
public class HelloWorld {
public int Main () {
// Init declaration produces error:
// Expression denotes a 'type', where a 'method group' was expected
Clutter c = new Clutter();
c.Init();
Stage stage = Stage.Default;
stage.Color = new Clutter.Color (0, 0, 0, 255);
stage.SetSize (512, 512);
stage.Show();
// Main declaration produces error:
// Expression denotes a 'type', where a 'method group' was expected
c.Main();
return 0;
}
}
}