HashSet is a collection, similar to a dataset, but its main purpose is to store elements of the same type (string, Row, table, and so on), and if the added element is inconsistent with the initial type defined, it will fail to compile directly.
For example:
Hashset<string> hs=new hashset<string>;
BOOL Result1=hs.add ("AA");//Returns True
BOOL Result2=hs.add ("BB");//Returns True
BOOL Result3=hs.add (33);//Direct grammar does not pass
Another example:
DataRow dr=new DataRow ();
Hashset<datarow > Hs=new hashset<datarow >;
BOOL Result1=hs.add ("AA");//Direct grammar does not pass
BOOL Result2=hs.add (DR);//Returns True
If we want to determine whether the elements inside the hashset are duplicated, the direct hs.count (), if greater than 1, indicates there is duplicate data, otherwise there is no repetition. In addition, we can use HS. Unionwith the data merge for distinct.
C # HashSet (temporary notes, no references, please be cautious)