using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Threading;namespace ConsoleApplication1
{
class Program
{
public delegate void Messageprintdelegate(string msg);
private delegate int GetcountDelegate(person obj1, person obj2);
protected delegate void Lonrunningdelegate(Messageprintdelegate mpcallback);
static void Longrunningmethod(Messageprintdelegate mpd)
{
for (int i = 0; i < 99; i++)
{
if (i % 10 == 0)
{
mpd(string.Format("Making progress.{0}% complete.", i));
}
}
} static int Getcount(object obj1, object obj2)
{
Random rnd = new Random();
return rnd.Next();
} static void printmessage(string msg)
{
Console.WriteLine("{0} {1}",DateTime.Now.ToShortTimeString(),msg);
}
static void Main(string[] args)
{
Messageprintdelegate mpdel = new Messageprintdelegate(printmessage);
GetcountDelegate gcd = new GetcountDelegate(Getcount);
int count = gcd(new person(), new person());
Console.WriteLine("Count received {0}",count);
Lonrunningdelegate lrd = new Lonrunningdelegate(Longrunningmethod);
lrd(mpdel);
Console.ReadLine();
}
}
class person
{
} class contact : person
{
}
}
解决方案 »
- C# 如何检查子窗口是否已经创建
- 求解关于C#串口的奇怪情况,本人菜鸟,没发现是哪里出问题了,请求大侠帮帮忙,谢了。
- 在C#(后台代码CS文件)中如何取到input的name值。(在线等~~~)
- 一般门户网站的后台模块有哪些
- 如何获取短日期类型!
- 看看这个databinding出了什么问题:
- 如何给GIF图片加上水印图片
- 来看看此贴不错,个人肯定会受益。问个很好奇的问题,欢迎大家来回答。
- C#对devexpress.xtraGrid.Views.Grid.GridView中不包含Rows的定义并且找不到可接受类型为
- 要作个分销系统,请大家建议是使用B/S好,还是C/S好?
- 代码访问共享的问题
- WindowsForm里的 DataGridView显示速度慢
能解决一些看似复杂的问题