摘要: 管理位值的压缩数组,该值表示为布尔值,其中true表示位是打开的(1),false表示位是关闭的(0) using System; using System.Collections; public class SamplesBitArray { public static void Main() { // Creates and initializes several BitArrays. BitArray myBA1 = new BitArray( 5 ); BitArray myBA2 = new BitArray( 5, false ); byte[] myBytes = new byt 阅读全文
posted @ 2011-04-22 15:19 Kingdom_0 阅读(2263) 评论(0) 推荐(0) 编辑
摘要: 提供了一个简单结构,该结构以32位内存存储布尔和小数值 对于内部使用的布尔值和小整数,BitVector32 比 BitArray 更有效。 BitArray 可以按需要无限地扩大,但它有内存和性能方面的系统开销,这是类实例所要求的。 相比之下,BitVector32 只使用 32 位。 BitVector32 结构可以设置成包含小整数的若干节或包含布尔值的若干位标志,但不能同时包含两者。 BitVector32.Section 是 BitVector32 中的窗口,且由最小数量的连续位构成,连续位可以包含 CreateSection 中指定的最大值。 例如,带有最大值 1 的节只由一个位构成 阅读全文
posted @ 2011-04-22 15:16 Kingdom_0 阅读(2648) 评论(0) 推荐(0) 编辑
摘要: 1:比较和排序的概念 比较:两个实体类之间按>,=,<进行比较。 排序:在集合类中,对集合类中的实体进行排序。排序基于的算法基于实体类提供的比较函数。 基本型别都提供了默认的比较算法,如string提供了按字母进行比较,int提供了按整数大小进行比较。2:IComparable和IComparer 当我们创建了自己的实体类,如Student,默认想要对其按照年龄进行排序,则需要为实体类实现IComparable接口。 class Student:IComparable { public string Name { get; set; } public int Age { get; 阅读全文
posted @ 2011-04-22 09:34 Kingdom_0 阅读(462) 评论(0) 推荐(0) 编辑