08 2012 档案

c#遍历枚举中的项
摘要:Type type = typeof(enumTest); foreach (FieldInfo x in type.GetFields(BindingFlags.Public | BindingFlags.Static)) { enumTest item = (enumTest)x.GetValue(null); }思路:遍历枚举的公共且静态的Field,获取Field的值;然后将值强制转为枚举类型。 阅读全文

posted @ 2012-08-31 09:49 ayao 阅读(835) 评论(0) 推荐(0) 编辑

c#使用HttpWebRequest向指定url Post数据
摘要:HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.yang1.com/test.aspx"); request.Method="POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] byteArr = Encoding.UTF8.GetBytes("a=test"); request.ContentLe... 阅读全文

posted @ 2012-08-31 09:42 ayao 阅读(330) 评论(0) 推荐(0) 编辑

导航

点击右上角即可分享
微信分享提示