04 2021 档案
摘要:public class CustomPager { /// <summary> /// 每页行数 /// </summary> public int PageSize { get; set; } /// <summary> /// 总行数 /// </summary> public int Tot
阅读全文
摘要:Model Binder(模型绑定器),顾名思义,可以形象的理解为将数据绑定到一个 Model 的工具。这个 Model 是 Action 方法需要用到的某个类型(既可以是方法参数的类型也可以是方法内部对象的类型),要绑定到它上面的值可以来自于多种数据源。 MVC 框架内置默认的 Model Bin
阅读全文
摘要:public class ControlComputer { /// <summary> /// 重启当前程序 /// </summary> public static void ReStartApplicationSelf() { System.Diagnostics.Process.Start(
阅读全文
摘要:添加一个类继承JsonResult public class CustomJsonResult : JsonResult { private const string _dateFormat = "yyyy-MM-dd HH:mm:ss"; public CustomJsonResult() { s
阅读全文
摘要:使用工具:VS2015 基于.NET fromwork4.6.1 1.创建ASP.NET Web 应用程序 2.选择一个空结构的MVC项目 3.项目结构: 4.创建控制器 和 视图 5.新建两个类库项目IServices/IBll 一个用来声明接口,一个用来实现 ISerivces: public
阅读全文
摘要:IOC(控制反转) + DI(依赖注入) 面向接口编程 Unity、AutoFac、Spring.Net、Castie等 基础功能示例: class Dog { public void Voice() { Console.WriteLine("Dog Wang.wang"); } public vo
阅读全文
摘要:VS2105 包程序管理器:PM=>install-package log4net 新建控制台程序(Log4j) 配置AppConfig <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section
阅读全文
摘要:引用NuGet :CodeCarvings.Piczard /// <summary> /// 生成缩略图 /// </summary> /// <param name="imageWidth">图片宽</param> /// <param name="imageHigh">图片高</param>
阅读全文
摘要:static void Main(string[] args) { var stu1 = new Student() { Name = "张三", Age = 18, Sallry = 9000 }; var stu2 = new Student() { Name = "李四", Age = 15,
阅读全文
摘要:IAuthorizationFilter 可用于登录检查,判断是否登录 IActionFilter Action拦截器 方法执行前后拦截 IResultFilter Result拦截器 方法返回前后拦截 ExceptionFilter Exception拦截器 异常处理拦截 同一返回错误界面 Fil
阅读全文
摘要:界面演示: Controller: public ActionResult F1() { DataTable dt = new DataTable(); DataColumn dc1 = new DataColumn("ID",Type.GetType("System.Int32")); DataC
阅读全文
摘要:效果 使用工具有VS2015、mariadb-10.3.7-winx64.msi、Google Chrome Controllers: using MVC.Models; using System; using System.Collections.Generic; using System.Dat
阅读全文
摘要:反射可以在运行时获取类的信息(方法、字段、父类信息等等)。可以动态创建对象。动态调用对象 Type 每一个类都对应一个Type可以通过下面三种方式获得: Type type1 = OBJ.GetType(); Type type2 = typeof(OBJ); Type type3 = Type.G
阅读全文
摘要:通过两种方法: TaskFactory/ParallelOptions class Program { static void Main(string[] args) { int num = 10; ControlTaskNum(num); UseParallelOptions(num); } //
阅读全文
摘要:public static void LogToFile(string LogFilePath, string LogFileName, string doWhat, string msg) { string stmp = "时间:" + DateTime.Now.ToString("yyyy-MM
阅读全文
摘要:声明根节点 private TreeNode root1; private TreeNode root2; private TreeNode root3; private TreeNode root4; public Form1() { InitializeComponent(); Load +=
阅读全文
浙公网安备 33010602011771号