EasyMES/WaterCloud.Code/AsyncTaskHelper.cs
2022-10-20 17:12:54 +08:00

34 lines
764 B
C#

using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace WaterCloud.Code
{
public class AsyncTaskHelper
{
/// <summary>
/// 开始异步任务
/// </summary>
/// <param name="action"></param>
public static void StartTask(Action action)
{
try
{
Action newAction = () =>
{ };
newAction += action;
Task task = new Task(newAction);
task.Start();
}
catch (Exception ex)
{
LogHelper.WriteWithTime(ex);
}
}
}
}