using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace GrammarDemo
{
class Program
{
static void Main(string[] args)
{
HashSet<string> set = new HashSet<string>();
set.Add("a");
set.Add("b");
set.Add("c");
//不可以重复
set.Add("a");
//无顺序,不能用索引来访问
foreach (var item in set)
{
Console.WriteLine(item); //abc
}
Console.WriteLine("--------------------");
Hashtable hashtable = new Hashtable();
hashtable.Add("key1","a");
hashtable.Add("key2","b");
hashtable.Add("key3","c");
foreach (var item in hashtable.Keys)
{
Console.WriteLine(hashtable[item]);//b,c,a
}
Console.Read();
}
}
}