随笔分类 - C#
摘要:1 Stopwatch timer = new Stopwatch(); 2 timer.Start(); 3 //要测试的代码 4 timer.Stop();
阅读全文
摘要:public class Student { public int Id { get; set; } public string Name { get; set; } public int Age { get; set; } public DateTime date { set; get; } }
阅读全文
摘要:// 随机生成指定长度的验证码字符串 public ActionResult GetValidateCode(string key) { string codeStr = GetRandomCode(); TempData[key] = codeStr; return File(GetVCo...
阅读全文
摘要:其他信息: 未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.85.0.0, Culture=neutral, PublicKeyToken=ad1060f7 将项目版本改为4.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...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Common { public class DateUtils { /// /// 时间转换为...
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要:一、校验数字的表达式 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,...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Web; using System.Web.Mvc; namespace XG.Web.Controllers { /// /// 验证码获取 /// pu...
阅读全文
摘要:using System.IO; using System.Runtime.Serialization.Json; using System.Text; namespace WebTest.Controllers { public class JsonConvert { /// /// 将对象转换为json /// ...
阅读全文
摘要:1 class Program 2 { 3 static void Main(string[] args) 4 { 5 Person person1 = new Chiness("吉米"); 6 Person person2 = new Japanese("山本"); 7 person1.SayHe
阅读全文
摘要:一、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
阅读全文
摘要:一、不完整类型(partial type)实例 结果:
阅读全文
摘要: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()
阅读全文
摘要:一、1:Ref 在调用前必须初始化参数,Out 不用初始化 2:Out 在方法中必须给参数赋值,但Ref不用 二、Ref 和 Out 的使用 1、Ref 1 /// <summary> 2 /// 入口函数 3 /// </summary> 4 /// <param name="args"></pa
阅读全文
摘要:一、委托的使用 1:首先来看看委托的使用 1)传统的委托使用的分为三步。 1 /// <summary> 2 /// 定义委托 3 /// </summary> 4 /// <param name="x">变量 x</param> 5 /// <param name="y">变量 y</param>
阅读全文

浙公网安备 33010602011771号