A shot in the dark is here, since I have no idea what you are asking ...
edit ... just read your question with NB. Now, generally speaking, I would advise HIGH against the concept of using functional programming to assign values to your data objects. Instead, I would advise you to create a new object that includes the PushPin and Distance property, or you use the map to store distance information as a kind of “Extension Property”.
var observer = localStoreCollection.ToObservable(); observer.Subscribe(StoresOnNext, StoresOnError, StoresOnCompleted); var closestObservable = observer.Min(Comparer<PushPin>.Create((a, b) => Double.Comparer(Distance(a), Distance(b)));
Or maybe even
var observer = localStoreCollection.ToObservable(); observer.Subscribe(StoresOnNext, StoresOnError, StoresOnCompleted); var distanceMap = new ConcurrentDictionary<PushPin, double>(); var closestObservable = observer.Min(Comparer<PushPin>.Create((a, b) => Double.Comparer(distanceMap.GetOrAdd(a, Distance), distanceMap.GetOrAdd(b, Distance)));
if the Distance(PushPin) function is expensive.
source share