摘要: /// /// 清楚HTML中的特殊字符 /// /// /// public static string DelHTML(string Htmlstring) { if (string.IsNullOrEmpty(Htmlstring)) return ""; //特殊的字符 Htmlstring = Htmlstring.Replace("&", ""); Htmlstring = Htmlstring.Replace("", ""); Htmlstring = Htmlstring 阅读全文
posted @ 2013-08-12 17:18 永不言败,自信相伴 阅读(482) 评论(0) 推荐(0) 编辑
摘要: #region 将Html特殊字符转义处理 /// /// 将Html特殊字符转义处理 /// /// 需要专业的内容 /// public static string HtmlCode(string strHC) { string strR = string.Empty; if (string.IsNullOrEmpty(strHC)) return ""; strR = strHC.Replace("&", "&"); strR = strR.Replace(">", " 阅读全文
posted @ 2013-08-12 17:17 永不言败,自信相伴 阅读(1130) 评论(0) 推荐(0) 编辑
摘要: /// /// 截取字符窜 /// /// 待截取字符串 /// 截取字符串长度 /// public static string GetSubString(string p_SrcString, int p_Length) { string myResult = p_SrcString; if (p_Length >= 0) { byte[] bsSrcString = System.Text.Encoding.GetEncoding("GB2312").GetBytes(p_SrcString); if (bsSrcString.Length > p_Len 阅读全文
posted @ 2013-08-12 17:16 永不言败,自信相伴 阅读(251) 评论(0) 推荐(0) 编辑
摘要: /// /// 截取需要的字符串(非字节处理) /// /// 需要截取的字符串 /// 截取长度 /// 被截取的字符串结尾追加符 /// public string GetSubString(string inputStr, int len, string ss = "") { if (inputStr.Length < len) return inputStr; return inputStr.Substring(len) + ss; } 阅读全文
posted @ 2013-08-12 17:15 永不言败,自信相伴 阅读(183) 评论(0) 推荐(0) 编辑
摘要: #region 时间格式转换为yyyy-mm-dd hh:mm:ss.fff /// /// 时间格式转换为yyyy-mm-dd hh:mm:ss.fff /// /// /// public static string ConvertDateTime(object obj) { if (obj != null && !string.IsNullOrEmpty(obj.ToString())) { try { return ((System.DateTime)(obj)).ToString("yyyy-MM-dd HH:mm:ss.fff"); } catc 阅读全文
posted @ 2013-08-12 16:43 永不言败,自信相伴 阅读(545) 评论(0) 推荐(0) 编辑
摘要: #region 时间戳转为时间 /// /// 时间戳转为时间 /// /// /// public static DateTime GetTime(string stringTime) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); long lTime = long.Parse(stringTime + "0000000"); TimeSpan toNow = new TimeSpan(lTime); return dtStart.Add(toNow 阅读全文
posted @ 2013-08-12 16:42 永不言败,自信相伴 阅读(186) 评论(0) 推荐(0) 编辑
摘要: #region 去除HTML标记 /// /// 去除HTML标记 /// /// 包括HTML的源码 /// 已经去除后的文字 public static string NoHTML(string Htmlstring) { //删除脚本 Htmlstring = Regex.Replace(Htmlstring, @"", "", RegexOptions.IgnoreCase); //删除HTML Htmlstring = Regex.Replace(Htmlstring, @"]*)>", "", R 阅读全文
posted @ 2013-08-12 16:40 永不言败,自信相伴 阅读(246) 评论(0) 推荐(0) 编辑
摘要: /// /// /// 待加密字串 /// 加密后的字串 public static string MD5Encrypt(string strSource) { return MD5Encrypt(strSource, 32); } /// /// /// 待加密字串 /// 16或32值之一,其它则采用.net默认MD5加密算法 /// 加密后的字串 public static string MD5Encrypt(string strSource, int length) { byte[] bytes = Encoding.ASCII.GetBytes(strSo... 阅读全文
posted @ 2013-08-12 16:39 永不言败,自信相伴 阅读(853) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.Serialization.Json;using System.IO;using System.Data;using System.ComponentModel;using System.Web.UI.WebControls;namespace SieCom.YQ.Common{ public class CommondLibray { pu 阅读全文
posted @ 2013-08-12 16:37 永不言败,自信相伴 阅读(465) 评论(0) 推荐(0) 编辑
摘要: #region 根据URL获取结果集 /// /// 根据URL获取结果集 默认为GET,如果数据量大了可以传入POST /// /// URL地址 /// 默认为GET,删除时用DELETE /// String类型的,Json格式的结果集 public static string GetUrlResult(string url, string type = "GET") { string result = string.Empty; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); requ 阅读全文
posted @ 2013-08-12 16:35 永不言败,自信相伴 阅读(311) 评论(0) 推荐(0) 编辑
摘要: #region List 转 Json /// /// List 转 Json /// /// 实体对象 /// List对象 /// public static string ObjectToJson(T obj) { try { DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType()); using (MemoryStream ms = new MemoryStream()) { serializer.WriteObject(ms, obj); return Encod... 阅读全文
posted @ 2013-08-12 16:32 永不言败,自信相伴 阅读(2000) 评论(0) 推荐(0) 编辑
摘要: public enum枚举名称 { /// ///注释描述1 /// [Description("注释描述1")]//通过Description可以通过C#方法读取到描述信息 Yes = 1, /// ///注释描述2 /// [Description("注释描述2")] No = 0 } 阅读全文
posted @ 2013-08-12 16:30 永不言败,自信相伴 阅读(1310) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading;namespace NetWorkCreeper{ public partial class Form2 : Form { public Form2() { InitializeComponent(); 阅读全文
posted @ 2013-08-12 16:25 永不言败,自信相伴 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 在C#中用多线程并不难实现。它有一个命名空间:System.Threading,提供了多线程的支持。 要开启一个新线程,须要以下的初始化:ThreadStart startDownload = new ThreadStart( DownLoad ); //线程起始设置:即每个线程都执行DownLoad(),注意:DownLoad()必须为不带有参数的方法Thread downloadThread = new Thread( startDownload ); //实例化要开启的新类downloadThread.Start();//开启线程 由于线程起始时启动的方法不能带有参数,这就为多线程共享. 阅读全文
posted @ 2013-08-12 16:20 永不言败,自信相伴 阅读(9216) 评论(0) 推荐(0) 编辑