admin管理员组文章数量:1393577
I made following observable, that filters only changes for given ResourceId:
var valueChangesObs = events
.GroupBy(e => e.ResourceId)
.SelectMany(e => e.DistinctUntilChanged(e => e.ResouceValue))
However, the there will be too many groups overtime and I need to clean them.
I have another observable, that emits value, when ResourceId becomes deprecated and can be removed.
How to remove specific groups produced by GroupBy over time to avoid memory leak?
I'm have something TakeUntil in mind:
var valueChangesObs = events
.GroupBy(x => x.ResourceId)
.TakeUntil(group => g))
.SelectMany(group => group
.DistinctUntilChanged(x => x.ResouceValue)
.TakeUntil(x => resourceDeprecatedObservable.First(y => y.ResourceId = x.ResourceId)));
I made following observable, that filters only changes for given ResourceId:
var valueChangesObs = events
.GroupBy(e => e.ResourceId)
.SelectMany(e => e.DistinctUntilChanged(e => e.ResouceValue))
However, the there will be too many groups overtime and I need to clean them.
I have another observable, that emits value, when ResourceId becomes deprecated and can be removed.
How to remove specific groups produced by GroupBy over time to avoid memory leak?
I'm have something TakeUntil in mind:
var valueChangesObs = events
.GroupBy(x => x.ResourceId)
.TakeUntil(group => g))
.SelectMany(group => group
.DistinctUntilChanged(x => x.ResouceValue)
.TakeUntil(x => resourceDeprecatedObservable.First(y => y.ResourceId = x.ResourceId)));
Share
Improve this question
edited Mar 12 at 9:30
Liero
asked Mar 12 at 9:01
LieroLiero
27.5k41 gold badges179 silver badges337 bronze badges
3
|
1 Answer
Reset to default 0Use the .GroupByUntil
operator
本文标签: cHow to clean groups from produced by GroupByStack Overflow
版权声明:本文标题:c# - How to clean groups from produced by GroupBy - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744763089a2623869.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
How to remove specific groups produces by GroupBy over time to avoid memory leak?
- since you say specific groups, what is the specification? and why isn't a simple Where sufficient? e.g.events.Where(x => IsResourceIdGood(x.ResourceId)).GroupBy(x => x.ResourceId)
– Rand Random Commented Mar 12 at 9:09