随笔分类 -  C#

摘要:第一种方式:System.Diagnostics.Stopwatch stopwatch = new Stopwatch();stopwatch.Start(); // 开始监视代码运行时间// 需要测试的代码 ....stopwatch.Stop(); // 停止监视TimeSpan tim... 阅读全文
posted @ 2015-02-05 09:55 ZCoding 阅读(23818) 评论(1) 推荐(3) 编辑
摘要:1、新建项目添加WatermarkTextBox类:using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Drawing;using System... 阅读全文
posted @ 2015-02-03 11:59 ZCoding 阅读(4995) 评论(0) 推荐(0) 编辑
摘要:第一种方法:正则表达式 string text = "是不是汉字"; for (int i = 0; i = 0x4e00 && (int)c[i] 127) Console.WriteLine("是汉字"); ... 阅读全文
posted @ 2015-01-08 10:52 ZCoding 阅读(5108) 评论(0) 推荐(0) 编辑
摘要:第一种方法:try{ if (int.Parse(textBox1.Text) > 0) { //操作代码 } else { MessageBox.Show("必须是正整数"); }}catch (FormatException){ ... 阅读全文
posted @ 2015-01-08 10:32 ZCoding 阅读(4352) 评论(0) 推荐(0) 编辑
摘要:/// java时间戳格式时间戳转为C#格式时间 public static DateTime GetTime(long timeStamp){ DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970... 阅读全文
posted @ 2014-12-29 17:12 ZCoding 阅读(2949) 评论(0) 推荐(0) 编辑
摘要:1、同时显示日期和时间DateTimePicker dtp = new DateTimePicker(); dtp.Format = DateTimePickerFormat.Custom;dtp.CustomFormat = "yyyy-MM-dd HH:mm:ss";2、时间选择方式dtp.Sh... 阅读全文
posted @ 2014-12-29 16:49 ZCoding 阅读(8180) 评论(0) 推荐(0) 编辑