文章分类 -  常用类总结

摘要:1,需要添加文件HtmlAgilityPack.dll以及对它的引用2,类码public class XPathClass { /// <summary> /// 返回节点内的文本值,如<span>文字</span>,返回"文字" /// </summary> /// <param name="htmlSource">html页面源代码</param> /// <param name="xpath">xpath路径</param> /// 阅读全文
posted @ 2013-01-31 11:39 金河 阅读(3711) 评论(0) 推荐(0) 编辑
摘要:1,类内容: public static class SerializerUtil { #region 序列化位二进制 /// <summary> /// 序列化位二进制 /// </summary> /// <param name="request">要序列化的对象</param> /// <returns>字节数组</returns> public static byte[] SerializeBinary(object reques... 阅读全文
posted @ 2012-12-14 14:40 金河 阅读(646) 评论(0) 推荐(0) 编辑
摘要:1,为了将xml文档中的数据反序列化为对象,下面这个类包含了三个常用类,和一个反序列化对象类。(1)对象类LeiXing /// <summary> /// 物业类型 /// </summary> [Serializable] [XmlRoot] public class LeiXing { [XmlElement] public string Value { get; set; } [XmlElement] public string Text { get; set; } }(2)EFdr... 阅读全文
posted @ 2012-12-13 23:25 金河 阅读(239) 评论(0) 推荐(0) 编辑
摘要:1,ControlValueJson类:内部一个成员变量public Dictionary<string, string> ControlValue = new Dictionary<string, string>();用来保存标签的id和value; 方法ResponJson()返回json字符串。 public class ControlValueJson { /// <summary> /// key控件id,value控件值 /// </summary> public Dictionary<string, string> C. 阅读全文
posted @ 2012-12-13 13:02 金河 阅读(485) 评论(0) 推荐(0) 编辑
摘要:1 HttpClient类View Code /*HttpClient client=new HttpClient(url);string html=client.GetString();GetString()函数内部会查找Http Headers, 以及HTML的Meta标签,试图找出获取的内容的编码信息.如果都找不到,它会使用client.DefaultEncoding, 这个属性默认为utf-8, 也可以手动设置.自动保持Cookie, RefererHttpClient client=new HttpClient(url1, null, true);string html1=clien 阅读全文
posted @ 2012-12-01 14:06 金河 阅读(320) 评论(0) 推荐(0) 编辑