随笔分类 -  C#

摘要:换了工作单位,离住的地方有点远,13公里的样子,每天要挤公交车啊~有时候挤不上去有时候贴在公交的门上,非常可怜的一直站到终点站再导车。每天都有些老头老太太上车,挤不上还不干,上来自然要有人给它们让座啊,它们有老年证。。。。啥叫早高峰???早上从7点到9这是属于早高峰啊,这些老太太老大爷上来干啥?我是观察了很久了:有的是去钓鱼,有的是去公园玩、溜湾,有些是去超市门口排队买便宜鸡蛋的。。。。。。。还有很多,很多原因。有些人有估计要吐血了,咱小老百姓上个班容易吗?这些老东西偏在要这个早高峰来挤。不给让座显得没有传统美德,如果让座打心里觉得不值。就不能避开早高峰吗?送一个字:贱! 阅读全文
posted @ 2012-05-29 10:11 咸鱼公子 阅读(757) 评论(1) 推荐(2)
摘要:并行开发/运行public void ParalleTest() { //invoke,for和forEach。 Parallel.Invoke(CheckOrder, CheckOrder); Parallel.For(0, 20000000, i => { // do sth }); Parallel.ForEach(Partitioner.Create(0, 20000000), i => { for (int m = i.Item1; m < i.Item2; m++) { // do sth } }); } 阅读全文
posted @ 2012-05-23 15:24 咸鱼公子 阅读(303) 评论(0) 推荐(0)
摘要:子窗口private void btn_OK_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } private void btn_Cancel_Click(object sender, EventArgs e) { this.Close(); }父窗口 Form4 f4 = new Form4(); //f4.Location = Point point = this.Location; point.X += 220; point.Y -=330; f4 阅读全文
posted @ 2012-05-16 11:46 咸鱼公子 阅读(240) 评论(0) 推荐(0)
摘要://加载xml数据 private void buttonX1_Click(object sender, EventArgs e) { //读取xml //BuildDataGrid(GetObjectArrayList(@"E:\TDDOWNLOAD\设计模式\AbstractFactory\ObjectIdentity\xml\"), this.tabControlPanel1); // BuildDataGrid(GetObjectArrayList(@"E:\TDDOWNLOAD\设计模式\AbstractFactory\ObjectIdentity\xm 阅读全文
posted @ 2012-05-03 15:50 咸鱼公子 阅读(2983) 评论(1) 推荐(0)
摘要:去掉datagridview左边第一列DataGridView -> 属性 -> 设置RowHeadersVisible = False. 阅读全文
posted @ 2012-05-02 17:36 咸鱼公子 阅读(171) 评论(0) 推荐(0)
摘要:以下是app.config或web.config的定义,定义了一个参数,键为Isinit,值为false<?xml version="1.0"?> <configuration> <appSettings> <add key ="IsInit" value="false"/> </appSettings> </configuration>以下是读和写config文件的方法定义:写入:internal void settingApp_write(string key 阅读全文
posted @ 2012-03-31 16:47 咸鱼公子 阅读(3592) 评论(0) 推荐(0)
摘要:asp.net client端的设置 1、首先修改web.Config文件,加入以下设置: Xml代码 <authenticationmode="Forms"><formsname="casauth"loginUrl="login.aspx"/></authentication><authorization><denyusers="?"/></authorization><authentication mode="Forms&q 阅读全文
posted @ 2012-02-01 12:19 咸鱼公子 阅读(2094) 评论(1) 推荐(0)
摘要:1:一个接口可以声明多个或者零个成员2:接口的成员必须是方法、属性、事件或者索引器3:接口不能包含常量、字段、运算符、实力构造函数、析构函数或者类型,也不能包含任何种类的静态成员4:所有的接口成员都隐式的具有public访问属性5:接口成员声明中包含任何修饰符都属于编译时错误,具体来说不能使用修饰符:abstruct、public、protected、internal、private、virtual、overried、或者static来声明接口成员using System;interface IDrivingLicenceB{ void getLicence();}interface IDri 阅读全文
posted @ 2012-01-30 16:38 咸鱼公子 阅读(341) 评论(0) 推荐(0)
摘要:protected void ReStartApplication() { Thread.Sleep(2000); Process.Start(this.GetType().Assembly.Location); Application.Exit(); } 阅读全文
posted @ 2012-01-18 10:03 咸鱼公子 阅读(1233) 评论(0) 推荐(0)
摘要:http://hi.baidu.com/jiang_yy_jiang/blog/item/23294013384be4c7f6039e2e.htmlpublic class JPService { public JPService() { //设定最大的Net并发连接数 System.Net.ServicePointManager.DefaultConnectionLimit = 500; ThreadPool.SetMinThreads(15 , 2);//设置最小的工作线程数和IO线程数 Config.Load(); } private int MaxThread = 1... 阅读全文
posted @ 2012-01-18 09:05 咸鱼公子 阅读(10272) 评论(0) 推荐(0)
摘要:在一个项目中想实现以上功能,在项目中加入一个 Global.aspx文件即可实现。public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { //定义定时器 System.Timers.Timer myTimer = new System.Timers.Timer(5000); myTimer.Elapsed += new ElapsedEventHandler(myTimer_Elapsed); myTimer.Enabl.. 阅读全文
posted @ 2012-01-06 21:27 咸鱼公子 阅读(508) 评论(0) 推荐(0)
摘要:首先引入两个dll文件 Microsoft.mshtml.dll和SHDocVw.dll大概路径为C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Common\Microsoft.mshtml.dllC:\Windows\System32\SHDocVw.dll下面的代码只是在页面加载完成之后进行的截图,这种截图方法不能截取falsh,视频等,会出现空白的情况,而且如果你只截取一次倒无妨,如果想要每间隔几秒截取1张,你会发现截取的图片完全一样。本代码为我的测试性代码,为省事写的比较 阅读全文
posted @ 2011-12-28 12:15 咸鱼公子 阅读(1956) 评论(1) 推荐(0)
摘要:public static class LinqExtendTest { public static int wordCount(this String str) { return str.Split(' ').Length; } public static string TMatch(this string str,this string regStr) { return Regex.Match(str, regStr).Value; } } 阅读全文
posted @ 2011-12-12 00:50 咸鱼公子 阅读(147) 评论(0) 推荐(0)
摘要:10个C#编程和Visual Studio使用技巧介绍10个C#编程和Visual Studio IDE使用技巧。 1、Environment.Newline你是否知道这个属性是与平台无关的?允许你根据每个平台输出新的换行字符。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Console.WriteLine("My Tips On ,{0}C#", Environment.NewLine); 2、命名空间别名你是否知道可 阅读全文
posted @ 2011-12-07 10:10 咸鱼公子 阅读(441) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2011-11-30 09:05 咸鱼公子 阅读(13) 评论(0) 推荐(0)
摘要:就是比如说有在银行有排队是排一个队伍的,但是有很多个窗口处理的。这种单队列多服务台的。 阅读全文
posted @ 2011-11-16 11:37 咸鱼公子 阅读(161) 评论(0) 推荐(0)
摘要:自已研究一下,有新发现,以前没发现这么多 Thread mainThread; Thread childThread; private void btnRun_Click(object sender, EventArgs e) { mainThread = new Thread(()=>ReadThread()); mainThread.IsBackground = true; mainThread.Start(); } protected void ReadThread() { int works = 100; for (int i = 0; i < nums; i++) { c 阅读全文
posted @ 2011-11-12 14:30 咸鱼公子 阅读(944) 评论(1) 推荐(0)
摘要:string url = new Uri(m_uri, match.Groups["url"].Value).AbsoluteUri;这样可以拼接出URL地址获取match中的文本string text = match.Groups["text"].Value;substring 和indexof//url = "http://www.gome.com.cn/product/1000014732.html" pku = url.Substring(url.LastIndexOf("/") + 1, url.Leng 阅读全文
posted @ 2011-10-18 15:11 咸鱼公子 阅读(145) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Text;using System.IO;using System.Collections;//using iTextSharp;//下载这个DLL即可using iTextSharp.text;using iTextSharp.text.pdf;namespace PDFGenerator{ class Program { static void Main(string[] args) { Document document = new Document(); PdfWrit 阅读全文
posted @ 2011-08-30 15:35 咸鱼公子 阅读(501) 评论(0) 推荐(0)
摘要:private void btnRun_Click(object sender, EventArgs e) { Thread th = new Thread(new ThreadStart(heating)); th.IsBackground = true; th.Start(); } int templeture; delegate void DisplayHandler(string tempStr); protected void heating() { for (int i = 0; i < 100; i++) { templeture = i; string tp = i.To 阅读全文
posted @ 2011-08-12 10:33 咸鱼公子 阅读(297) 评论(1) 推荐(0)