編譯器錯誤 C3904
'property_accessor': 必須指定 number 參數(s)
針對屬性維度檢查 和 get
set
方法中的參數數目。
方法的參數
get
數目必須等於 屬性的維度數目,或非索引屬性的維度數目為零。方法的參數
set
數目必須大於 屬性的維度數目。
如需詳細資訊,請參閱 property。
範例
下列範例會產生 C3904。
// C3904.cpp
// compile with: /clr /c
ref class X {
property int P {
// set
void set(); // C3904
// try the following line instead
// void set(int);
// get
int get(int, int); // C3904
// try the following line instead
// int get();
};
};
下列範例會產生 C3904。
// C3904b.cpp
// compile with: /clr /c
ref struct X {
property int Q[double, double, float, float, void*, int] {
// set
void set(double, void*); // C3904
// try the following line instead
// void set(double, double, float, float, void*, int, int);
// get
int get(); // C3904
// try the following line instead
// int get(double, double, float, float, void*, int);
}
};