posted @ 2007-10-27 12:25
随笔分类 - A-.net点滴积累
摘要:“线程池”是可以用来在后台执行多个任务的线程集合,这使主线程可以自由地异步执行其他任务。线程池通常用于服务器应用程序。每个传入请求都将分配给线程池中的一个线程,因此可以异步处理请求,而不会占用主线程,也不会延迟后续请求的处理。一旦池中的某个线程完成任务,它将返回到等待线程队列中,等待被再次使用。这种重用使应用程序可以避免为每个任务创建新线程的开销。线程池通常具有最大线程数限制。如果所有线程都...
阅读全文
摘要:简单的事件例子 using System; using System.Collections.Generic; using System.Text; namespace EventDemo { //声明一个委托 public delegate void SalaryCompute(); //事件发布者 public class Emplo...
阅读全文
posted @ 2007-10-27 10:02
摘要://sql语句批处理 string select = "SELECT COUNT(*) FROM Customers; SELECT COUNT(*) FROM Products"; using (SqlConnection conn = new SqlConnection(source)) { conn.Open(); SqlCommand cmd = new S...
阅读全文
posted @ 2007-10-21 09:34
摘要:using System; using System.Data; using System.Data.SqlClient; SqlConnection myConnection = new SqlConnection("Data Source=localhost;Initial Catalog=Northwind;Integrated Security=SSPI;"); myConnectio...
阅读全文
posted @ 2007-10-16 15:03
摘要:using Microsoft.Win32; //写入 RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true); RegistryKey myKey = softwareKey.CreateSubKey("myKey"); myKey.SetValue("key1", (object)"value...
阅读全文
posted @ 2007-10-16 14:58
摘要:using System.IO; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Soap; using System.Xml.Serialization; // 序列化为二进制 FileStream fileStream = new FileS...
阅读全文
posted @ 2007-10-16 14:56
浙公网安备 33010602011771号