編譯器錯誤 CS1014
更新:2007 年 11 月
錯誤訊息
必須是 get 或 set 存取子
在屬性宣告中找到方法宣告。您只能在屬性中宣告 get 和 set 方法。
如需屬性的詳細資訊,請參閱使用屬性 (C# 程式設計手冊)。
範例
下列範例會產生 CS1014。
// CS1014.cs
// compile with: /target:library
class Sample
{
public int TestProperty
{
get
{
return 0;
}
int z; // CS1014 not get or set
}
}