Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Property or indexer 'property' cannot be assigned to — it is read only
An attempt was made to assign a value to a property, but the property does not have a set accessor. Resolve the error by adding a set accessor. For more information, see How to: Declare and Use Read/Write Properties (C# Programming Guide).
Example
The following sample generates CS0200:
// CS0200.cs
public class MainClass
{
// private int _mi;
int I
{
get
{
return 1;
}
// uncomment the set accessor and declaration for _mi
/*
set
{
_mi = value;
}
*/
}
public static void Main ()
{
MainClass II = new MainClass();
II.I = 9; // CS0200
}
}