区间结构

主要要来做区间控制,比如查询订单,查询条件是创单时间 这区间就是开始-结束,

或者查询机票就是 出发- 到达

下面记录区间结构代码

 1     /// <summary>
 2     /// 区间
 3     /// </summary>
 4     /// <typeparam name="T">区间类型</typeparam>
 5     [Serializable]
 6     [DataContract]
 7     public struct Range<T>
 8     {
 9         /// <summary>
10         /// The _lower.
11         /// </summary>
12         private T lower;
13 
14         /// <summary>
15         /// The _upper.
16         /// </summary>
17         private T upper;
18 
19         /// <summary>
20         /// Initializes a new instance of the <see cref="Range{T}"/> struct.
21         /// </summary>
22         /// <param name="lower">
23         /// The lower.
24         /// </param>
25         /// <param name="upper">
26         /// The upper.
27         /// </param>
28         public Range(T lower, T upper)
29         {
30             this.lower = lower;
31             this.upper = upper;
32         }
33 
34         /// <summary>
35         /// 下限(时间开始)
36         /// </summary>
37         [DataMember]
38         public T Lower
39         {
40             get { return this.lower; }
41             set { this.lower = value; }
42         }
43 
44         /// <summary>
45         /// 上限(时间结束)
46         /// </summary>
47         [DataMember]
48         public T Upper
49         {
50             get { return this.upper; }
51             set { this.upper = value; }
52         }
53     }
View Code

 

posted @ 2015-02-13 16:17  刘小吉  阅读(255)  评论(0编辑  收藏  举报