3 namespace System.Collections.Generic {
8 public class HashSet<T> : Dictionary<T, bool>,
IEnumerable<T> {
14 : base((IEqualityComparer<T>)comparer) {
19 foreach (var item
in items) {
25 List<T> removal =
new List<T>();
26 foreach (var item
in this) {
27 if (!items.Contains(item)) {
31 foreach (var item
in removal) {
37 return this.Where<T>(x => items.Contains(x)).Count() > 0;
41 List<T> removal =
new List<T>();
42 foreach (var item
in this) {
43 if (items.Contains(item)) {
47 foreach (var item
in removal) {
53 return ContainsKey(item);
61 var removal = this.Where<T>(predicate);
62 foreach (var item
in removal) {
67 public bool Add(T item) {
75 public T
this[
int index] {
76 get {
throw new NotImplementedException(); }
80 return this.Keys.GetEnumerator();
84 return this.Keys.ToArray();
void UnionWith(IEnumerable< T > items)
void ExceptWith(HashSet< T > items)
bool Overlaps(HashSet< T > items)
This is a minimal implementation of the missing HashSet from Silverlight BCL It's nowhere near the re...
void IntersectWith(HashSet< T > items)
new IEnumerator< T > GetEnumerator()
void RemoveWhere(Func< T, bool > predicate)
HashSet(StringComparer comparer)