随笔分类 -  C#

摘要:1 Stopwatch timer = new Stopwatch(); 2 timer.Start(); 3 //要测试的代码 4 timer.Stop(); 阅读全文
posted @ 2019-07-31 09:37 码到世界末日 阅读(194) 评论(0) 推荐(0)
摘要:原因: 阅读全文
posted @ 2019-03-20 13:52 码到世界末日 阅读(548) 评论(0) 推荐(0)
摘要:public class Student { public int Id { get; set; } public string Name { get; set; } public int Age { get; set; } public DateTime date { set; get; } } 阅读全文
posted @ 2019-01-14 09:56 码到世界末日 阅读(120) 评论(0) 推荐(0)
摘要:// 随机生成指定长度的验证码字符串 public ActionResult GetValidateCode(string key) { string codeStr = GetRandomCode(); TempData[key] = codeStr; return File(GetVCo... 阅读全文
posted @ 2018-12-27 09:51 码到世界末日 阅读(161) 评论(0) 推荐(0)
摘要:其他信息: 未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.85.0.0, Culture=neutral, PublicKeyToken=ad1060f7 将项目版本改为4.0 阅读全文
posted @ 2018-04-19 15:32 码到世界末日 阅读(371) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Text; using System... 阅读全文
posted @ 2017-04-27 16:28 码到世界末日 阅读(169) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Common { public class DateUtils { /// /// 时间转换为... 阅读全文
posted @ 2016-12-29 15:14 码到世界末日 阅读(369) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Common { public class HttpUtils ... 阅读全文
posted @ 2016-12-29 15:14 码到世界末日 阅读(317) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Common { public class L... 阅读全文
posted @ 2016-12-29 15:12 码到世界末日 阅读(229) 评论(0) 推荐(0)
摘要:一、校验数字的表达式 1 数字:^[0-9]*$ 2 n位的数字:^\d{n}$ 3 至少n位的数字:^\d{n,}$ 4 m-n位的数字:^\d{m,n}$ 5 零和非零开头的数字:^(0|[1-9][0-9]*)$ 6 非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(.[0-9]{1,2})?$ 7 带1-2位小数的正数或负数:^(\-)?\d+(\.\d{1,... 阅读全文
posted @ 2016-12-19 16:17 码到世界末日 阅读(149) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Web; using System.Web.Mvc; namespace XG.Web.Controllers { /// /// 验证码获取 /// pu... 阅读全文
posted @ 2016-12-09 16:40 码到世界末日 阅读(528) 评论(0) 推荐(0)
摘要:using System.IO; using System.Runtime.Serialization.Json; using System.Text; namespace WebTest.Controllers { public class JsonConvert { /// /// 将对象转换为json /// ... 阅读全文
posted @ 2016-12-09 14:56 码到世界末日 阅读(144) 评论(0) 推荐(0)
摘要:1 class Program 2 { 3 static void Main(string[] args) 4 { 5 Person person1 = new Chiness("吉米"); 6 Person person2 = new Japanese("山本"); 7 person1.SayHe 阅读全文
posted @ 2016-11-02 10:48 码到世界末日 阅读(308) 评论(0) 推荐(0)
摘要:一、LINQ查询表达式基础 1、简单的 LINQ 查询 1 static class Program 2 { 3 static void Main(string[] args) 4 { 5 List<Student> list = new List<Student>() 6 { 7 new Stud 阅读全文
posted @ 2016-08-17 16:55 码到世界末日 阅读(192) 评论(0) 推荐(0)
摘要:一、不完整类型(partial type)实例 结果: 阅读全文
posted @ 2016-08-17 16:02 码到世界末日 阅读(573) 评论(0) 推荐(0)
摘要:一、特性实例 结果: 阅读全文
posted @ 2016-08-17 15:33 码到世界末日 阅读(301) 评论(0) 推荐(0)
摘要:一、不安全的代码实例 结果: 阅读全文
posted @ 2016-08-17 15:31 码到世界末日 阅读(323) 评论(0) 推荐(0)
摘要:1、IOException 1 public static void Test1() 2 { 3 FileStream fs = null; 4 try 5 { 6 fs = new FileStream("d:\\file.txt", FileMode.Open); 7 fs.ReadByte() 阅读全文
posted @ 2016-08-17 11:12 码到世界末日 阅读(225) 评论(0) 推荐(0)
摘要:一、1:Ref 在调用前必须初始化参数,Out 不用初始化 2:Out 在方法中必须给参数赋值,但Ref不用 二、Ref 和 Out 的使用 1、Ref 1 /// <summary> 2 /// 入口函数 3 /// </summary> 4 /// <param name="args"></pa 阅读全文
posted @ 2016-08-16 10:32 码到世界末日 阅读(196) 评论(0) 推荐(0)
摘要:一、委托的使用 1:首先来看看委托的使用 1)传统的委托使用的分为三步。 1 /// <summary> 2 /// 定义委托 3 /// </summary> 4 /// <param name="x">变量 x</param> 5 /// <param name="y">变量 y</param> 阅读全文
posted @ 2016-08-15 17:29 码到世界末日 阅读(223) 评论(0) 推荐(0)