作者superttl (ttl)
看板C_Sharp
标题[问题] 有关 C# 程式码 compile 时的错误
时间Thu Mar 29 11:13:57 2012
Dear ALL:
小弟在 compile 一个 C# 的 project 时,
出现了一段错误
错误 1 型别 'Settings.Settings' 中没有型别名称
'Settings' Program.cs 15 46 Settings
以下为程式码(Program.cs)
---------------------------------------------
namespace Settings
{
using System;
using System.Windows.Forms;
internal static class Program
{
[STAThread]
private static void Main(string[] args)
{
if (args.Length == 0)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Settings.Settings());
^^^^^^^^^^他跟我说这边有误
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
WebSettings mainForm = new WebSettings {
Acc = args[0]
};
Application.Run(mainForm);
}
}
}
}
---------------------------------------------
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 123.192.149.134
1F:→ optimist9266:借问Settings.Settings是方法还是类别,如果是方法 03/29 20:21
2F:→ optimist9266:我建议你把new运算子看懂 03/29 20:21
3F:推 funnyface325:你namespace和Form都叫Settings,系统也帮你产生一个 04/04 00:00
4F:→ funnyface325:Settings.settings放资源的类, 编译的时候就搞混到 04/04 00:01
5F:→ funnyface325:到底是要编译成form还是资源设定档???? 04/04 00:01
6F:→ funnyface325:PS:路径-> 专案\Properties\Settings.settings 04/04 00:02