编译器错误 CS0102
更新:2007 年 11 月
错误消息
类型“type name”已经包含“identifier”的定义
一个类在同一范围内包含多个具有相同名称的标识符的声明。若要修复此错误,请重命名重复的标识符。
示例
下面的示例生成 CS0102。
// CS0102.cs
// compile with: /target:library
namespace MyApp
{
public class MyClass
{
string s = "Hello";
string s = "Goodbye"; // CS0102
public void GetString()
{
string s = "Hello again"; // method scope, no error
}
}
}