usingSystem.Collections;usingSystem.Text.RegularExpressions;namespacedemo1{/// <summary>/// 常用的集合类型有动态数组(ArrayList类)、堆栈(Stack类)、Queue类和Hashtable类/// </summary>internalclassprogrm{staticvoidMain(string[] args){//动态数组元素的添加//创建一个arraylist实例,大小为5ArrayList array =newArrayList(5);Console.WriteLine("arraylist中包含的元素个数{0}", array.Count);array.Add(100);//添加一个整数类型array.Add("i love you");Console.WriteLine("arraylist中包含的元素个数{0}",array.Count);string[] s1 ={"孙","李","王"};array.AddRange(s1);//遍历foreach(object i in array){Console.WriteLine("array内的元素{0}",i);}//删除元素array.RemoveRange(0,1);foreach(object i in array){Console.WriteLine("array内的元素{0}", i);}}}}
堆栈
usingSystem.Collections;namespacedemo1{/// <summary>/// 堆栈后进先出的对象集合/// </summary>internalclassprogrm{staticvoidMain(string[] args){Stack stack =newStack();//实例化一个对象Console.WriteLine("向堆栈的顶部添加四个对象");stack.Push('a');stack.Push('b');stack.Push('c');stack.Push('d');Console.WriteLine(stack.Count);foreach(object item in stack){Console.WriteLine(item);}Console.WriteLine("向堆栈的顶部添加2个对象");stack.Push('e');stack.Push("f");foreach(object item in stack){Console.WriteLine(item);}Console.WriteLine("堆栈顶部的对象{0}",stack.Peek());Console.WriteLine("移除堆栈顶部的对象{0}",stack.Pop());Console.WriteLine("遍历堆栈");foreach(object item in stack){Console.WriteLine(item);}}}}
队列
usingSystem.Collections;namespacedemo1{/// <summary>/// 队列:先进先出/// </summary>internalclassprogrm{staticvoidMain(string[] args){//列表中添加一项,称为入队//列表中移除一项,成为出队Queue queue =newQueue();//创建一个队列Console.WriteLine("向队列中添加元素");queue.Enqueue('a');queue.Enqueue('b');queue.Enqueue('c');queue.Enqueue('d');Console.WriteLine("遍历队列");foreach(object i in queue){Console.WriteLine("队列中元素{0}",i);}Console.WriteLine("向队列中添加元素");queue.Enqueue('e');queue.Enqueue("f");Console.WriteLine("遍历队列");foreach(object i in queue){Console.WriteLine("队列中元素{0}", i);}Console.WriteLine("移除队列开头的元素{0}",queue.Dequeue());Console.WriteLine("遍历队列");foreach(object i in queue){Console.WriteLine("队列中元素{0}", i);}}}}
哈希表
usingSystem.Collections;namespacedemo1{/// <summary>/// 哈希表类似于python中的字典/// </summary>internalclassprogrm{staticvoidMain(string[] args){Hashtable ht =newHashtable();Console.WriteLine("元素添加方法1");ht.Add(1,"周一");ht.Add(2,"周二");ht.Add(3,"周三");ICollection key = ht.Keys;foreach(int i in key){Console.WriteLine(i);}Console.WriteLine("元素添加方法2");ht[4]="周四";Console.WriteLine("打印哈希表");foreach(object i in ht.Values){Console.WriteLine(i);}foreach(DictionaryEntry obj in ht){Console.WriteLine("键:{0},值:{1}",obj.Key,obj.Value);}//删除ht.Remove(1);Console.WriteLine("打印哈希表");foreach(DictionaryEntry obj in ht){Console.WriteLine("键:{0},值:{1}", obj.Key, obj.Value);}}}}
目录 MySQL导入SQL Server
使用 SQL Server Management Studio (SSMS) 导入导出向导:
使用 SQL Server Integration Services (SSIS):
SQL Server 导入 MySQL
使用 SQL Server Management Studio (SSMS) 导出数据:
使用 MySQL Workbench…