Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
'property': la proprietà non ha un metodo 'set'
Osservazioni:
Non è stato definito un metodo della funzione di accesso di una proprietà. Per altre informazioni, vedere property.
Example
L'esempio seguente genera l'errore C3070:
// C3070.cpp
// compile with: /clr
ref class R {
public:
R(int size) {
m_data = gcnew array<int>(size);
}
property int % MyProp[int] {
int% get(int index) {
return m_data[index];
}
}
property int % MyProp2[int] {
int% get(int index) {
return m_data[index];
}
void set(int index, int % value) {}
}
property const int % MyProp3[int] {
const int% get(int index) {
return m_data[index];
}
void set(int index, const int % value) {}
}
private:
array<int>^ m_data;
};
int main() {
R^ r = gcnew R(10);
r->MyProp[4] = 4; // C3070
int value = 4;
r->MyProp2[4] = value; // OK
r->MyProp3[4] = 4; // OK
}