Is there a better (or more appropriate way) of implementing method overloading for my usecase here?
I have two methods of a class I'm writing - in one usecase I want to update the field with no return value and in the other, I want to return the new value after it's been updated with the provided parameter. My current implementation doesn't raise any warnings, but VS does recommend that I remove unused parameters, so wondering if there's a feature or technique I could use to achieve the same effect
6 Replies
i'm not sure what you're going for
why not just have one method that always returns the new value, and ignore it if you don't need to use it?
I... hadn't actually thought about that
Completely forgot that was even possible
there's no rule that says you have to do something with the returned value
š
That's an excellent point, thank you!
Could even explicitly discard it
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.