
C#获取字符串长度,一个汉字长度为2
/// <summary>/// 获取字符串长度,一个汉字长度为2/// </summary>/// <param name="inputString">参数字符串</param>/// <returns></returns>public static int StrLength(string inputString){System.Text.ASCIIEncoding asc…
/// <summary>/// 获取字符串长度,一个汉字长度为2/// </summary>/// <param name="inputString">参数字符串</param>/// <returns></returns>public static int StrLength(string inputString){System.Text.ASCIIEncoding asc…
/// <summary>/// 获取用户客户端IP/// </summary>public static string GetUserIp(){string ip;string[] temp;bool isErr = false;if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_ForWARDED_For"] == null)ip = System.Web.Http…
/// <summary>/// 导出Excel/// </summary>/// <param name="obj"></param>public void ExportData(GridView obj){try{string style = "";if (obj.Rows.Count > 0){style = @"<style> .text { mso-number-format:\…
1,初始化直接赋值List<string> list = new List<string>{"A","B","C"};2,list.add()的方式List<string> tlist = new List<string>();tlist.Add("A");tlist.Add("B");tlist.Add("C");
"未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0, 错误的解决方案:请检查 web.config 配置的版本号跟实际版本号对不对,web.config配置的引用要和你引用的版本对应,两个的版本号应该与你程序需要的这个版本一致,配置如下:<dependentAssembly> <as…
Lucene.net 盘古分词中Highlighter高亮组件的使用方法:Highlighter highlighter = new Highlighter(new SimpleHTMLFormatter("<span style=\"color:red\">", "</span>"), new Segment());highlighter.FragmentSize = 255;string r…
C#生成一万以内所有不重复数字的四位数:for (int i = 0; i < 10; i++){for (int j = 0; j < 10; j++){for (int m = 0; m < 10; m++){for (int n = 0; n < 10; n++){if (i != j && i != m & i != n && j != m && j != n && m…
C#/.NET/.NET Core的定时任务调度组件:Timer、FluentScheduler、TaskScheduler、Gofer.NET、Coravel、Quartz.NET、Hangfire。Timer类 Timer是.NET内置的定时器类,它位于命名空间System.Timers下。Timer是一个基于服务器端的计时器,提供了Interval属性来设置重复触发定时任务…