黃小二的讀書筆記
有才而性緩定屬大才,有智而氣和斯為大智。人偏狹我受之以寬容,人險仄我持之以坦蕩。緩事宜急干,敏則有功;急事宜緩辦,忙則多措。 --李叔同
首頁
新隨筆
聚合
管理
隨筆-7 評論-24 文章-102 trackbacks-0
C# 定時器使用一例
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication1
{
class
Program
{
static
void
Main(
string
[] args)
{
AddRoomTimer timer
=
new
AddRoomTimer();
while
(
true
)
{
if
(AddRoomTimer.COUNT
>
0
)
{
Console.WriteLine(
string
.Format(
"
第{0}次調用
"
,
101
-
AddRoomTimer.COUNT));
AddRoomTimer.COUNT
--
;
}
}
//
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
//
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
}
}
public
class
AddRoomTimer
{
//
靜態計數器變量
public
static
int
COUNT
=
0
;
public static System.Threading.Timer timer;
//
靜態構造, 最多運行一次
static
AddRoomTimer()
{
//
多線程定時器, 每隔 10000毫秒調用一次被委托的方法 TimerCallBack
timer
=
new
System.Threading.Timer(TimerCallBack,
null
,
0
,
10000
);
}
private
static
void
TimerCallBack(
object
obj)
{
//
打印一次時間, 測試用
Console.WriteLine(DateTime.Now.ToString());
//
計數器變量重置
COUNT
=
100
;
}
}
}
posted on 2009-06-16 00:11
黃小二
閱讀(1342)
評論(0)
編輯
收藏
所屬分類:
ASP.NET
、
C#
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
[筆記] 技巧/訣竅:在ASP.NET中重寫URL
ASP.NET 會話狀態
asp.net獲取網站路徑
asp.net對于圖像文件的操作--存儲、讀取訪問
[轉] DataBinder.Eval用法
[轉]Response.Redirect(),Server.Transfer(),Server.Execute()的區別
Enterprise Library 4 之 DAAB使用
存儲過程返回的多結果集數據,ado 訪問調用
Enterprise Library 企業庫筆記
C# XML的一點記錄
<
2025年6月
>
日
一
二
三
四
五
六
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
文章分類
(147)
[DB](5)
[DB].MySQL(7)
[DB].Oracle(14)
[DB].SQL Server(8)
Ajax(13)
ASP.NET(18)
C#(19)
J2EE(22)
J2SE(12)
S/S2SH(15)
Web Design(8)
雜談(6)
文章檔案
(108)
2010年6月 (1)
2010年5月 (12)
2010年4月 (18)
2009年9月 (3)
2009年8月 (2)
2009年7月 (6)
2009年6月 (3)
2009年5月 (7)
2009年4月 (10)
2009年3月 (1)
2009年1月 (1)
2008年12月 (4)
2008年11月 (1)
2008年10月 (17)
2008年9月 (17)
2008年8月 (2)
2008年7月 (3)
在線幫助
Java API Specifications
Java 開源大全
javaNB 在線文檔
MSDN 技術資源庫
MySQL 5.1參考手冊
Oracle Documentation
w3school 在線教程
開源軟件庫
Ajax/JavaScript腳本大全
Asp.net源碼專業站
CSDN開源頻道
CSS9.NET
源碼愛好者
社區
developerWorks 中國
最新評論
1.?re: SQL Server 2005/2008 對With Encryption選項創建的存儲過程解密
評論內容較長,點擊標題查看
--專業祛痘
2.?re: SQL Server 2005/2008 對With Encryption選項創建的存儲過程解密
評論內容較長,點擊標題查看
--lolola
3.?re: 在 WinForm中使用 WebClient上傳文件
44444444444444444444444
--熱熱
4.?re: 使用 HibernateTemplate 實現分頁查詢 (HibernateCallback接口)
評論內容較長,點擊標題查看
--redcoatjk
5.?re: SQL Server 2005/2008 對With Encryption選項創建的存儲過程解密
評論內容較長,點擊標題查看
--謝謝樓主
評論排行榜
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 黃小二
主站蜘蛛池模板:
安龙县
|
托克逊县
|
奉新县
|
犍为县
|
汉沽区
|
山西省
|
新津县
|
凤凰县
|
崇阳县
|
凤山县
|
新野县
|
金川县
|
赤城县
|
焉耆
|
苍梧县
|
铅山县
|
新化县
|
山东省
|
蓝山县
|
塔城市
|
华坪县
|
宜川县
|
大邑县
|
天门市
|
民权县
|
阿尔山市
|
鹿泉市
|
手机
|
静宁县
|
乐昌市
|
安西县
|
思茅市
|
霞浦县
|
翁源县
|
岫岩
|
友谊县
|
泌阳县
|
浦县
|
固原市
|
临西县
|
宁安市
|