C
C#•2y ago
Thomoski

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
No description
6 Replies
Jimmacle
Jimmacle•2y ago
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?
Thomoski
ThomoskiOP•2y ago
I... hadn't actually thought about that Completely forgot that was even possible
Jimmacle
Jimmacle•2y ago
there's no rule that says you have to do something with the returned value šŸ˜„
Thomoski
ThomoskiOP•2y ago
That's an excellent point, thank you!
Angius
Angius•2y ago
Could even explicitly discard it
Accord
Accord•2y ago
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.

Did you find this page helpful?