© { JSL }
17
readonly Fields
·
readonly
instance fields...
w
are instance fields that cannot be assigned to
w
compile time errors
class
Pair
{
public
Pair(
int
x,
int
y)
{
this
.x = x;
this
.y = y;
}
public void
Reset()
{
x = 0;
y = 0;
}
private readonly int
x, y;
}
this declares Pair as
an immutable
object