G
Gustaf Liljegren
I guess this is a newbie question. I got an Account class with an Amount
property, like this:
public float Amount
{
get { return amount; }
set { amount = value; }
}
I need to add to this amount sometimes, but when I write like this
a.Amount += 10;
I get the error "The left-hand side of an assignment must be a variable,
property or indexer". Since a.Amount is a property, I don't understand the
complaint. Is this supposed to work or not?
Thanks,
Gustaf
property, like this:
public float Amount
{
get { return amount; }
set { amount = value; }
}
I need to add to this amount sometimes, but when I write like this
a.Amount += 10;
I get the error "The left-hand side of an assignment must be a variable,
property or indexer". Since a.Amount is a property, I don't understand the
complaint. Is this supposed to work or not?
Thanks,
Gustaf