日期:2014-05-17 浏览次数:20888 次
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace ClassLibrary1
{
public class Class1
{
public delegate void Test();
public Test test;
public Class1()
{
ThreadPool.QueueUserWorkItem(new WaitCallback(test1));
}
private void test1(object sender)
{
while (true)
{
Thread.Sleep(10000);
if (test != null)
test();
}
}
public void test2()
{
if (test != null)
test();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Resources;
namespace ConsoleApplication1
{
class Program
{
private static ResourceManager m_resourceManager = new ResourceManager("ConsoleApplication1.Localize", System.Reflection.Assembly.GetExecutingAssembly());
static void Main(string[] args)
{
Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
ClassLibrary1.Class1 c1 = new ClassLibrary1.Class1();
c1.test = new ClassLibrary1.Class1.Test(test);
c1.test2();
Console.ReadLine();
c1.test2();
Console.ReadLine();
}
&nb