摘要: public static T Deserialize(S stream) where S : Stream where T : class, new() { using (stream) { BinaryFormatter formatter = new BinaryFormatter();... 阅读全文
posted @ 2018-09-28 21:03 紅人 阅读(257) 评论(0) 推荐(0)
摘要: public static T Deserialize(string content) where T : class, new() { return JsonConvert.DeserializeObject(content); } public static string Serialize(T obj) wh... 阅读全文
posted @ 2018-09-28 21:02 紅人 阅读(1053) 评论(0) 推荐(0)
摘要: public static T Deserialize(S stream) where S : Stream where T : class, new() { using (stream) { XmlSerializer xmlSearializer = new XmlSerializer(type... 阅读全文
posted @ 2018-09-28 21:02 紅人 阅读(239) 评论(0) 推荐(0)
摘要: public static string ReplaceStr(string originalStr, string oldStr, string newStr) { if (string.IsNullOrEmpty(oldStr)) { return ""; } ... 阅读全文
posted @ 2018-09-28 21:01 紅人 阅读(972) 评论(0) 推荐(0)
摘要: public static bool CheckAgent() { bool flag = false; string agent = HttpContext.Current.Request.UserAgent; string[] keywords = { "Android", "iPhone", "iP... 阅读全文
posted @ 2018-09-28 20:59 紅人 阅读(1520) 评论(0) 推荐(0)
摘要: /// /// 获得当前绝对路径 /// /// 指定的路径 /// 绝对路径 public static string GetMapPath(string strPath) { if (strPath.ToLower().StartsWith("http://")) ... 阅读全文
posted @ 2018-09-28 20:57 紅人 阅读(195) 评论(0) 推荐(0)
摘要: /// /// 获得当前绝对路径 /// /// 指定的路径 /// 绝对路径 public static string GetMapPath(string strPath) { if (strPath.ToLower().StartsWith("http://")) ... 阅读全文
posted @ 2018-09-28 20:54 紅人 阅读(1048) 评论(0) 推荐(1)
摘要: /// /// 过滤特殊字符 /// /// /// public static string Htmls(string Input) { if (Input != string.Empty && Input != null) { ... 阅读全文
posted @ 2018-09-28 20:53 紅人 阅读(2068) 评论(0) 推荐(0)
摘要: /// /// 检测是否有Sql危险字符 /// /// 要判断字符串 /// 判断结果 public static bool IsSafeSqlString(string str) { return !Regex.IsMatch(str, @"[-|;|,|\/|\(|... 阅读全文
posted @ 2018-09-28 20:52 紅人 阅读(1116) 评论(0) 推荐(0)
摘要: /// /// 字符串字符处理 /// /// 等待处理的字符串 /// 处理后的字符串 /// //把TXT代码转换成HTML格式 public static String ToHtml(string Input) { StringBuilder sb... 阅读全文
posted @ 2018-09-28 20:51 紅人 阅读(1817) 评论(0) 推荐(0)
摘要: /// /// 普通集合转换Json /// /// 集合对象 /// Json字符串 public static string ToArrayString(IEnumerable array) { string jsonString = "["; ... 阅读全文
posted @ 2018-09-28 20:49 紅人 阅读(1995) 评论(0) 推荐(0)
摘要: /// /// DataSet转换为Json /// /// DataSet对象 /// Json字符串 public static string ToJson(DataSet dataSet) { string jsonString = "{"; ... 阅读全文
posted @ 2018-09-28 20:45 紅人 阅读(4364) 评论(3) 推荐(0)
摘要: /// /// DataReader转换为Json /// /// DataReader对象 /// Json字符串 public static string ToJson(DbDataReader dataReader) { StringBuilder jso... 阅读全文
posted @ 2018-09-28 20:45 紅人 阅读(1365) 评论(0) 推荐(0)
摘要: /// /// 中文转unicode /// /// public static string unicode_0(string str) { string outStr = ""; if (!string.IsNullOrEmpty(str)) ... 阅读全文
posted @ 2018-09-28 20:40 紅人 阅读(2668) 评论(0) 推荐(1)
摘要: public static string StripHTML(string html) { try { System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"标记 ... 阅读全文
posted @ 2018-09-28 20:38 紅人 阅读(366) 评论(0) 推荐(0)
摘要: /// /// Unicode 转换 ASCII /// /// 解码内容 /// public static string unHTMLEncode(string theText) { try { string... 阅读全文
posted @ 2018-09-28 20:37 紅人 阅读(1489) 评论(0) 推荐(1)
摘要: /// /// 键值数据保存XML文件 /// /// 文件名 /// 数据 public static bool SaveXmlFile(string filePath, string fileName, SerializableDictionary data) { ... 阅读全文
posted @ 2018-09-28 20:35 紅人 阅读(1003) 评论(0) 推荐(0)