集合论和.NET

发布于 2024-09-02 07:22:43 字数 178 浏览 1 评论 0 原文

最近,我遇到了一种情况,集合理论和集合数学完全符合我正在做的事情(假设有一种更简单的方法来完成我需要的东西 - 即 LINQ - 但我当时没有想到这一点)。但是我不知道有任何通用集库。当然 IEnumerables 提供了一些集合操作(​​并集等),但没有像交集或集合比较这样的操作。谁能指出适合这里的东西吗?使用泛型类型实现集合数学的东西?

Recently I came across a situation where set theory and set math fit what I was doing to the letter (granted there was an easier way to accomplish what I needed - i.e. LINQ - but I didn't think of that at the time). However I didn't know of any generic set libraries. Granted IEnumerables provide some set operations (Union, etc.), but nothing like Intersection or set comparison. Can anyone point out something that fits here? Something that implements set math using a generic type?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一曲琵琶半遮面シ 2024-09-09 07:22:43

框架 (3.5+) 中有 HashSet 可以满足您的需要。 .NET 4 还引入了 SortedSet 和通用接口 ISet

There is HashSet<T> in the framework (3.5+) that does what you need. .NET 4 also introduced SortedSet<T> and a common interface ISet<T>.

不疑不惑不回忆 2024-09-09 07:22:43

System.Collections.Generic.HashSet 有许多集合操作,包括子集、超集、交集、并集等。

http://msdn.microsoft.com/en-us/library/bb359438.aspx

我希望这对

乔有帮助

System.Collections.Generic.HashSet has a number of set operations including Subset, Superset,Intersection,Union etc.

http://msdn.microsoft.com/en-us/library/bb359438.aspx

I hope this helps

joe

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文