readonly property

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

Hello,
If i try and set the x part of Point returned from a Forms location
property the compiler says No.
e.g.

myForm.Location.X = 100;

It seems that the location property is magically returning a readonly
object. How is this so? I could really do with this feature but my
property doesn't seem happy with const or readonly next to it.

Any ideas?

Thanks,


bob
 
bob said:
If i try and set the x part of Point returned from a Forms location
property the compiler says No.
e.g.

myForm.Location.X = 100;

It seems that the location property is magically returning a readonly
object. How is this so? I could really do with this feature but my
property doesn't seem happy with const or readonly next to it.

Any ideas?

It's not that it's returning a readonly object - it's that you can't
set the property of a value type when the value itself is being
returned by another property.
 
Back
Top