コンパイラ エラー CS1018
更新 : 2007 年 11 月
エラー メッセージ
キーワード 'this' または 'base' が必要です。
不完全なコンストラクタ宣言が検出されました。
使用例
次の例では CS1018 エラーが生成されます。このサンプルでは、いくつかの解決方法も示されています。
// CS1018.cs
public class C
{
}
public class a : C
{
public a(int i)
{
}
public a () : // CS1018
// possible resolutions:
// public a () resolves by removing the colon
// public a () : base() calls C's default constructor
// public a () : this(1) calls the assignment constructor of class a
{
}
public static int Main()
{
return 1;
}
}