随笔分类 - C#
摘要:以下内容转自http://www.cnblogs.com/musickh/archive/2009/07/16/1524912.html,在此多谢博主!DateTime.Now=2009-7-16 5:20:56//今天DateTime.Now.Date.ToString(); "2009-7-16 0:00:00"//周起始日期DateTime.Now.Date.AddDays(-(int)(DateTime.Now.DayOfWeek)+1).ToString(); {2009-7-13 0:00:00} DateTime.Now.Date.AddDays(7-(int
阅读全文
摘要:OrderNum = (from s in g from f in dt.JXDW_ITIL_WORK_ORDER where s.CALL_ID == f.CALL_ID && (new string[] { "待回访", "回访中", "关闭" }).Contains(f.ORDER_STATUS) select f).Count(),
阅读全文
摘要:CTime = EntityFunctions.DiffSeconds(f.OPEN_DATE.Value , f.RESOLVED_DATE.Value),
阅读全文
摘要:http://blog.csdn.net/andamajing/article/details/7386965
阅读全文
摘要:delegate int del(int i);static void Main(string[] args){ del myDelegate = x => x * x; int j = myDelegate(5); //j = 25}创建表达式树类型:using System.Linq.Expressions;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { Expression<del> myET = x ...
阅读全文
摘要:class Test{ delegate void TestDelegate(string s); static void M(string s) { Console.WriteLine(s); } static void Main(string[] args) { // Original delegate syntax required // initialization with a named method. TestDelegate testDelA = new TestDelegate(M)...
阅读全文
摘要:// Create a handler for a click event.button1.Click += delegate(System.Object o, System.EventArgs e) { System.Windows.Forms.MessageBox.Show("Click!"); };// Create a delegate.delegate void Del(int x);// Instantiate the delegate using an anonymous method.Del d = delegate(int k) { /* ...
阅读全文
摘要:http://msdn.microsoft.com/zh-cn/library/ms173171
阅读全文
摘要:http://msdn.microsoft.com/zh-cn/library/8627sbea
阅读全文
摘要:在C#中,你给一个方法传输参数时,实际上是使用的这个参数的一个副本,就是将原来的变量复制一份,然后传给一个方法,让其进行操作。所以在方法内部对参数的修改等不会对原来的参数造成影响。但是有些时候,又需要这种影响。ref的作用就是这个。它将变量本身而不是副本传给方法,所以对参数的修改原来变量的值。int a = 0;Console.WriteLine(a.ToString()); //输出是0public void ModifyVaule(ref int a){ a = 1;}Console.WriteLine(a.ToString()); // 输出是1。此外,out修饰符也起到这个作用...
阅读全文
摘要:http://blog.csdn.net/jianbin1062/article/details/6093337
阅读全文
摘要:t = new Thread(new ThreadStart(delegate { Play(sender, e); Console.WriteLine("Play ended."); })); t.Start(); private void Play(object sender, EventArgs e) { Console.WriteLine("InvokeRequired = " + InvokeRequired); ...
阅读全文
摘要:Thread thread = new Thread(new ThreadStart(delegate { AuroraSocketClient.Connect("192.168.0.12"); })); thread.Start(); Thread t = new Thread(new ThreadStart(delegate { try { seatDay = SeatAlgorithm.GetSeatTotalDayData(); ...
阅读全文
摘要:private void timer1_Tick_1(object sender, EventArgs e) { //开辟新线程,不占用主线程 Thread t = new Thread(new ThreadStart(delegate { timer1.Stop(); while (true) { Console.WriteLine("in timer1_Tick_1"); if (result.Count >= number) { Console.WriteLine("result.Count = " + result.Count); Cons
阅读全文
摘要:可以直接在父窗口定义一个字段为子窗口;使用子窗口的时候就初始化,用完关闭。
阅读全文
摘要:private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].CellType.Name == "DataGridViewCheckBoxCell") { //Console.WriteLine(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Valu...
阅读全文
摘要:private void AddHeaderCheckBox() { HeaderCheckBox = new CheckBox(); HeaderCheckBox.Size = new Size(20, 20); dataGridView1.Controls.Add(HeaderCheckBox); } private void HeaderCheckBox_MouseClick(object sender, MouseEventArgs e) { Heade...
阅读全文
摘要:rowHeadersVisible = false;
阅读全文

浙公网安备 33010602011771号