Reputation: 9439
Suppose I have a third-party library with a shared (static) property with a getter that initializes some state, and I want to call it without using the returned value. Obviously, if that property on foo is named Bar, I could do:
Dim dummy = foo.Bar
Is there a good way to call this that doesn't require the dummy reference?
Upvotes: 1
Views: 224
Reputation: 17845
No. If you try to call it without assigning the value:
foo.Bar
the error message is pretty clear:
Property access must assign to the property or use its value.
Property getters should just return state and shouldn't have any side-effects, so it makes no sense to call it without using the return value. It's an unfortunate design by the third-party library.
Upvotes: 5