关于C#命名空间的提问——同行请进

来源:百度知道 编辑:UC知道 时间:2024/05/25 10:55:02
这有两个.cs文件 Program.cs 和 Class1.cs
Program.cs 如下:
using System;
using System.Collections.Generic;//(1)
using System.Text;//(2)

namespace _04_04
{
class Program
{
static void Main(string[] args)
{
PrintName a = new PrintName();
a.introduce();

}

}
}
Class1.cs如下:
using System;

namespace _04_04
{
public class PrintName
{
public void introduce()
{
Console.WriteLine("My name is A3.");
}
};
}
很简单的一个程序,现在要在命令行使用csc命令将它们编译为.exe
大家可以粘贴了去试一下,会编译出错。但把(1)(2)两个命名空间删除后就正常了。
多余的命名空间会导致程序出错???
恳请同行前辈点拨。

如果您是使用.Net Framework 1.1,那么编译肯定不能通过,因为System.Collection.Generic是.Net Framework 2.0所特有的。

请使用.Net Framework 2.0的csc.exe进行编译。

可能是命令行对未使用的资源审核比较严格