Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HashSet<T> on Windows Phone 7

Is there no System.Collections.Generic.HashSet on Windows Phone 7?

like image 707
j00hi Avatar asked Jan 22 '11 21:01

j00hi


People also ask

What is new HashSet in C#?

In C#, HashSet is an unordered collection of unique elements. This collection is introduced in . NET 3.5. It supports the implementation of sets and uses the hash table for storage. This collection is of the generic type collection and it is defined under System.

What is .NET HashSet?

A HashSet is an optimized collection of unordered, unique elements that provides fast lookups and high-performance set operations. The HashSet class was first introduced in . NET 3.5 and is part of the System.

How does a HashSet work C#?

A HashSet<T> object's capacity automatically increases as elements are added to the object. A HashSet<T> collection is not sorted and cannot contain duplicate elements. HashSet<T> provides many mathematical set operations, such as set addition (unions) and set subtraction.

Does HashSet implement IEnumerable?

You can implicitly convert HashSet<T> to IEnumerable<T> , because HashSet, like ewvery other generic collection type, implements IEnumerable<T> .


1 Answers

The Windows Phone 7 .NET libraries are comparable to what is provided in Silverlight 3.0 (which doesn't have HashSet). You can build something like a HashSet using a Dictionary. For example, see this MSDN forum post: http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/e1dd3571-dfb8-4abe-b63a-62106d6a4965/

like image 71
bobbymcr Avatar answered Oct 22 '22 02:10

bobbymcr