using System;
using System.Collections.Generic;
using System.Web;
using YTBtb.Bll;
using System.Runtime.Remoting.Messaging;
namespace YTBtb.Web
{
public class HandelHelper
{
public delegate void AddHandler(List<Infomations> infos, string path);
static void DownLoadImg(List<Infomations> infos, string path)
{
foreach (var info in infos)
{
if (info.PicturePath != null && info.PicturePath != "")
{
string newPic = info.PicturePath;
ImgHelper.SaveInfoPic(info, path, ref newPic);
}
}
}
static void AddComplete(IAsyncResult result)
{
AddHandler handler = (AddHandler)((AsyncResult)result).AsyncDelegate;
handler.EndInvoke(result);
}
public HandelHelper(List<Infomations> infos, string path)
{
AddHandler handler = new AddHandler(DownLoadImg);
IAsyncResult result = handler.BeginInvoke(infos, path, new AsyncCallback(AddComplete), "AsycState:OK");
}
}
}委托挺不错,最近需要,委托来下载图片!!记录下
最新推荐文章于 2025-10-09 13:55:33 发布
本文介绍了一个使用C#实现的异步图片下载助手类HandelHelper。该助手通过委托和异步调用的方式批量下载并处理图片信息。文章展示了如何定义异步处理逻辑及回调方法。
3638

被折叠的 条评论
为什么被折叠?



