《第10章整理ppt.ppt》由会员分享,可在线阅读,更多相关《第10章整理ppt.ppt(19页珍藏版)》请在第壹文秘上搜索。
1、System.Collections命名空间 1 0 0 1 1 1 0LengthBitArray flags=new BitArray(7)flags.Set(0,true);flags.Set(1,false);bool IsMarry=flags.Get(3);是否结婚性别(男女)try BitArray myBA3=new BitArray(8);myBA30=myBA31=myBA32=myBA33=false;myBA34=myBA35=myBA36=myBA37=true;myBA1.And(myBA3);catch(Exception myException)Console.
2、WriteLine(Exception:+myException.Message);public static void PrintValues(IEnumerable myList,int myWidth)int i=myWidth;foreach(Object obj in myList)if(i=0)i=myWidth;Console.WriteLine();i-;Console.Write(0,8,obj);Console.WriteLine();Console.WriteLine(Pop)tt0,myStack.Pop();Console.Write(Stack values:);P
3、rintValues(myStack,t);Console.WriteLine(Peek)tt0,myStack.Peek();Console.Write(Stack values:);PrintValues(myStack,t);public static void PrintValues(IEnumerable myCollection,char mySeparator)foreach(Object obj in myCollection)Console.Write(01,mySeparator,obj);Console.WriteLine();Console.Write(Queue va
4、lues:);PrintValuesIe(myQ.GetEnumerator();public static void PrintValues(IEnumerable myCollection)foreach(Object obj in myCollection)Console.Write(0,obj);Console.WriteLine();public static void PrintValuesIe(IEnumerator myIenum)while(myIenum.MoveNext()Console.Write(0,8,myIenum.Current);Console.WriteLine();