編譯器錯誤 CS0082
更新:2007 年 11 月
錯誤訊息
型別 'type' 已經保留具有相同參數型別的成員,名為 'name'
編譯時期的屬性會轉譯為在識別項前面具有 get_ 和 (或) set_ 的方法。如果您自行定義的方法與方法名稱衝突,則會產生錯誤。
範例
下列範例會產生 CS0082:
//cs0082.cs
class MyClass
{
//property
public int MyProp
{
get //CS0082
{
return 1;
}
}
//conflicting Get
public int get_MyProp()
{
return 2;
}
public static int Main()
{
return 1;
}
}