MVC使用Newtonsoft无需实体类,实现JSON数据返回给前端页面使用

//引用using Newtonsoft.Json; using Newtonsoft.Json.Linq; public ActionResult JsonSample() { ResponseResult obj = new ResponseResult(); try { …… 阅读全文

C#使用Linq To XML读取XML,Linq生成XML,Linq创建带属性或带节点XML

using System;using System.Xml.Linq;namespace Sample2{ class Program { static void Main(string[] args) { #region 写文件一(生成节点性质的) XDocument xdoc = new X …… 阅读全文

C#利用WinRAR实现压缩和解压缩

using System;using Microsoft.Win32;using System.Diagnostics;using System.IO;namespace MSCL{ /// /// 压缩解压类 /// public class ZipHelper { /// /// 利用 WinRAR 进行 …… 阅读全文

WebClient和HttpWebRequst区别

WebClient和HttpWebRequst是用来获取数据的2种方式,一般而言,WebClient更倾向于“按需下载”,事实上掌握它也是相对容易的,而HttpWebRequst则允许你设置请求头或者对内容需要更多的控制,后者有点类似于form中的submit。虽然两者都是异步请求事件,但是WebClient是基于事件的异步,而HttpWebRequst是基于代理的异步编程WebClient封 …… 阅读全文

C#中使用CDO.Message发送邮件,成功率极高

using CDO;using System;namespace ConsoleApp1{ class Program { static void Main(string[] args) { string from = "xxx"; string to = "xxx"; ... …… 阅读全文

C#通过反射获取类中的方法和参数个数,反射调用方法带参数

using System;using System.Reflection;namespace ConsoleApp2{ class Program { static void Main(string[] args) { //反射获取 命名空间+类名 string className = "Con... …… 阅读全文