方法的参数与可以统一成这样!
1 | using System; |
1 | using System.Collections.Generic; |
1 | using System.Linq; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | using System.Text; namespace Entity.Commons { /// <summary> /// 自定义谓词 /// </summary> public class VPredication : IEnumerable<KeyValuePair< string , object >> { Dictionary< string , object > dicv = null ; SpacePredication spacePredication = null ; /// <summary> /// 区间谓词 /// </summary> public SpacePredication SpacePredication { get { return this .spacePredication; } } /// <summary> /// 自定义区间 构造函数 /// </summary> public VPredication() { spacePredication = new SpacePredication(); dicv = new Dictionary< string , object >(); } /// <summary> /// 验证键是否存在值 /// </summary> /// <param name="index">键</param> /// <returns>bool</returns> public bool ContainsKey( string index) { return this .dicv.ContainsKey(index); } /// <summary> /// 索引器 /// </summary> /// <param name="index">索引值</param> /// <returns>值</returns> public object this [ string index] { get { if (dicv.ContainsKey(index)) return dicv[index]; else return null ; } } /// <summary> /// 增加新项 /// </summary> /// <param name="key">列枚举[只能接受非FLAG得单个枚举]</param> /// <param name="extremumPair"></param> public void AddItem( string key, object value) { this .dicv.Add(key, value); } /// <summary> /// 移除制定 列枚举 的项 /// </summary> /// <param name="key">列枚举[只能接受非FLAG得单个枚举]</param> public void RemoveItem( string key) { this .dicv.Remove(key); } #region IEnumerable<KeyValuePair<string,object>> 成员 public IEnumerator<KeyValuePair< string , object >> GetEnumerator() { return this .dicv.GetEnumerator(); } #endregion #region IEnumerable 成员 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this .dicv.GetEnumerator(); } #endregion } /// <summary> /// 区间谓词 /// </summary> public class SpacePredication : IEnumerable<KeyValuePair< string , ExtremumPair>> { Dictionary< string , ExtremumPair> dic = null ; /// <summary> /// 区间谓词 构造函数 /// </summary> public SpacePredication() { dic = new Dictionary< string , ExtremumPair>(); } /// <summary> /// 索引器 /// </summary> /// <param name="index">索引值</param> /// <returns>区间极值值对</returns> public ExtremumPair this [ string index] { get { return dic[index]; } } /// <summary> /// 验证键是否存在值 /// </summary> /// <param name="index">键</param> /// <returns>bool</returns> public bool ContainsKey( string index) { return this .dic.ContainsKey(index); } /// <summary> /// 增加新项 /// </summary> /// <param name="_enum">列枚举[只能接受非FLAG得单个枚举]</param> /// <param name="extremumPair"></param> public void AddItem( string key, ExtremumPair extremumPair) { this .dic.Add(key, extremumPair); } /// <summary> /// 移除制定 列枚举 的项 /// </summary> /// <param name="key">列枚举[只能接受非FLAG得单个枚举]</param> public void RemoveItem( string key) { this .dic.Remove(key); } #region IEnumerable<KeyValuePair<string,ExtremumPair>> 成员 public IEnumerator<KeyValuePair< string , ExtremumPair>> GetEnumerator() { return this .dic.GetEnumerator(); } #endregion #region IEnumerable 成员 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this .dic.GetEnumerator(); } #endregion } /// <summary> /// 区间极值值对 /// </summary> public class ExtremumPair { object leftValue, rightValue; /// <summary> /// 左极值 /// </summary> public object LeftValue { get { return leftValue; } } /// <summary> /// 右极值 /// </summary> public object RightValue { get { return rightValue; } } /// <summary> /// 区间极值值对 构造函数 /// </summary> /// <param name="leftValue">左极值</param> /// <param name="rightValue">右极值</param> public ExtremumPair( object leftValue, object rightValue) { this .leftValue = leftValue; this .rightValue = rightValue; } } /// <summary> /// 通用分页参数 结构 /// </summary> public class PagingParam { int pageSize = 10; int pageIndex = 1; int pageTotal = -1; /// <summary> /// 页面大小 /// </summary> public int PageSize { get { return pageSize; } } /// <summary> /// 页码 /// </summary> public int PageIndex { get { return pageIndex; } } public int PageTotal { get { return pageTotal; } } /// 构造函数 /// </summary> public PagingParam() { } /// <summary> /// 通用分页参数结构 构造函数 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="pageSize">页面大小</param> public PagingParam( int pageIndex, int pageSize) { this .pageIndex = pageIndex; this .pageSize = pageSize; this .pageTotal = PageSize; } public PagingParam( int pageIndex, int pageSize, int pageTotal) { this .pageIndex = pageIndex; this .pageSize = pageSize; this .pageTotal = pageTotal; } } } |
分类:
其它 / 系统架构
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示