Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 /// <param name="name"></param>
 /// <param name="direction">(/)</param>
 public Reverser(Type type, string name, ReverserInfo.Direction direction)
 {
     this._type      = type;
     this._info.name = name;
     if (direction != ReverserInfo.Direction.ASC)
     {
         this._info.direction = direction;
     }
 }
Beispiel #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="type">进行比较的类类型</param>
 /// <param name="name">进行比较对象的属性名称</param>
 /// <param name="direction">比较方向(升序/降序)</param>
 public SortList(Type type, string name, ReverserInfo.Direction direction)
 {
     _Type       = type;
     _Info._Name = name;
     if (direction != ReverserInfo.Direction.ASC)
     {
         _Info._Direction = direction;
     }
 }
Beispiel #3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="className">进行比较的类名称</param>
 /// <param name="name">进行比较对象的属性名称</param>
 /// <param name="direction">比较方向(升序/降序)</param>
 public Reverser(string className, string name, ReverserInfo.Direction direction)
 {
     try {
         this.type           = Type.GetType(className, true);
         this.info.name      = name;
         this.info.direction = direction;
     }
     catch (Exception e) {
         throw new Exception(e.Message);
     }
 }
        private bool isSortByStrLen = false; //是否按字段字符串长度排序

        /**/                                 /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">进行比较的类类型</param>
        /// <param name="name">进行比较对象的属性名称</param>
        /// <param name="direction">比较方向(升序/降序)</param>
        /// <param name="sortByStrLen">是否按字段字符串长度排序</param>
        public SortComparer(Type type, string name, ReverserInfo.Direction direction, bool sortByStrLen = false)
        {
            this.type      = type;
            this.info.name = name;
            if (direction != ReverserInfo.Direction.ASC)
            {
                this.info.direction = direction;
            }
            this.isSortByStrLen = sortByStrLen;
        }

        /**//// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="className">进行比较的类名称</param>
        /// <param name="name">进行比较对象的属性名称</param>
        /// <param name="direction">比较方向(升序/降序)</param>
        /// <param name="sortByStrLen">是否按字段字符串长度排序</param>
        public SortComparer(string className, string name, ReverserInfo.Direction direction, bool sortByStrLen = false)
        {
            try
            {
                this.type           = Type.GetType(className, true);
                this.info.name      = name;
                this.info.direction = direction;
                this.isSortByStrLen = sortByStrLen;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="t"></param>
 /// <param name="name"></param>
 /// <param name="direction">(/)</param>
 public Reverser(T t, string name, ReverserInfo.Direction direction)
 {
     this._type           = t.GetType();
     this._info.name      = name;
     this._info.direction = direction;
 }
Beispiel #6
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="t">进行比较的类型的实例</param>
 /// <param name="name">进行比较对象的属性名称</param>
 /// <param name="direction">比较方向(升序/降序)</param>
 public SortList(T t, string name, ReverserInfo.Direction direction)
 {
     _Type            = t.GetType();
     _Info._Name      = name;
     _Info._Direction = direction;
 }