如何从 IGrouping 中删除元素 [英] How to remove an element from an IGrouping

查看:25
本文介绍了如何从 IGrouping 中删除元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何直接从 IGrouping IGrouping 中删除对象?

How do I remove an object directly from an IGrouping IGrouping<DateTime, VMAppointment>?

我目前知道的唯一方法是生成一个没有相关元素的新 IGrouping,但我不喜欢这种方式,因为它会在我的应用程序中引起一些麻烦.

The only way I know of currently is to generate a new IGrouping without the concering element, but I don't like this way because it causes some trouble within my application.

有什么想法吗?

推荐答案

不,没有办法改变 IGrouping<,>,至少在一般情况下 - 即使你知道具体的类型,我不相信 .NET 框架公开的任何实现允许组发生变异.

No, there's no way to mutate an IGrouping<,>, at least in general - and even if you knew the concrete type, I don't believe any of the implementations exposed by the .NET framework allow the group to be mutated.

推测分组是某个查询的结果 - 因此,如果可能,请更改原始查询以排除您不感兴趣的值.

Presumably the grouping is the result of some query - so if possible, change the original query to exclude the values you aren't interested in.

这篇关于如何从 IGrouping 中删除元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆