
c#
苗条的小狐狸
这个作者很懒,什么都没留下…
展开
-
c#Math.Round保留两位小数,结果能除尽,不保留小数点后的.00
Math.Round(((decimal)submintNum / releaseNum) * 100, 2, MidpointRounding.AwayFromZero)原创 2020-03-16 11:31:54 · 1620 阅读 · 0 评论 -
C#获取终端类型
#region 获取终端类型 /// <summary> /// 获取终端类型 /// </summary> /// <returns></returns> public static BrowserTerminalModel GetBrowserTerminal()...原创 2020-03-09 11:12:08 · 391 阅读 · 0 评论 -
c#比较字符串(并且忽略大小写)Equals 对比 ToUpper 和 ToLower 提高效率
字符串比较(忽略大小写),一般我们都会写为 str1.ToUpper() == str2.ToUpper() 或者 str1.ToLower() == str2.ToLower()这样比较效率会比较低,特别是在循环中不断通过如上方法比较的话运行速度会很慢。如果我们用String对象的Equals方法比较的话,效率就会高些。String.Equals(比较值1,比较值2,条件) 这个方法返...原创 2018-12-14 10:14:29 · 2336 阅读 · 0 评论 -
C# List根据值找到索引值方法
List test = new List();int index = test .FindIndex(item=>item.Equals(888));下面是对象集合int sysIndex = eLists.FindIndex(item => item.GoodsNo.Equals(info.GoodsNo));var f = eLists[sysIndex];...原创 2019-01-17 14:15:57 · 18610 阅读 · 1 评论 -
C#中,定义了一个枚举,循环获取值方法
publicenumtestenum { aa, bb, cc, dd };foreach (testenum item in Enum.GetValues(typeof(testenum))){}Enum.GetValues(typeof(枚举的名称));可以获得指定枚举的枚举值。Enum.GetNames(typeof(枚举的名称));可以获得指定枚举的枚举名称。...原创 2019-01-12 11:17:02 · 540 阅读 · 0 评论 -
两种使用javascript和c#验证日期以及时间是否有效的方法
第一种://| 日期有效性验证//| 格式为:YYYY-MM-DD或YYYY/MM/DDfunction IsValidDate(DateStr){var sDate=DateStr.replace(/(^\s+|\s+KaTeX parse error: Expected 'EOF', got '\d' at position 227: …Date.replace(/[\̲d̲]{ 4,...原创 2019-02-18 11:25:12 · 908 阅读 · 0 评论 -
汉字js escape() 加密 C#后台解密的方法
当在前提页面中用js对汉字进行加密var strurl;//用于http的网络路径strurl = xxx.aspx?X=escape(str);当按照这个传递的路径打开新的页面时,在后台 PageLoad 中用:string HanZi = System.Web.HttpUtility.UrlDecode(Request.QueryString[“xxx”].ToString().Tri...原创 2019-03-06 20:50:10 · 1112 阅读 · 1 评论 -
c#正则截取字符串中的汉字
string Str = "hanzi汉字10230485932823eddsasfdho名字212432403==133"; foreach (Match match in new Regex(@"([\u4E00-\u9FFF])", RegexOptions.Singleline).Matches(Str)) { ...原创 2019-03-15 15:21:34 · 1637 阅读 · 0 评论