Fixed ambiguous overloads for `ObservableCacheEx.ExpireAfter()` and `ObservableListEx.ExpireAfter()`.
Also moved EnsureUniqueKeys() into proper order.
Currently, the following code produces an ambigous method error at compile-time, for the call to .ExpireAfter().
var source = new SourceCache<string, int>(x => x.GetHashCode());
var result = source.ExpireAfter(_ => TimeSpan.FromSeconds(1));
Since any fix for this would be a breaking change, I've implemented it by just consolidating all of the overloads into one method, for simplicity.
The issue itself is relatively minor, as it can be easily worked-around by doing...
var source = new SourceCache<string, int>(x => x.GetHashCode());
var result = source.ExpireAfter(
timeSelector: _ => TimeSpan.FromSeconds(1),
interval: null);
or
var source = new SourceCache<string, int>(x => x.GetHashCode());
var result = source.ExpireAfter(
timeSelector: _ => TimeSpan.FromSeconds(1),
scheduler: null);
Since this is a breaking change with low impact, I would propose NOT merging this until we already have a major-version change queued up, due to other issues or enhancements.
Even though it's a breaking change, I think this is a good thing. Waiting until a major release mitigates the breaking change somewhat... Thanks for this.
Maybe we should examine the APIs for similar ambiguous overloads and put all the fixes into a feature branch that can be merged before the next major rev. That would be better than making more breaking changes later.
Turns out the list version of ExpireAfter has the exact same issue, so I added the fix for that as well.
@JakenVeina apart form merge conflicts, is this ready?
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.