摘要: core 2.0中通过实现IHostedService接口实现后台任务 public interface IHostedService { Task StartAsync(CancellationToken cancellationToken); Task StopAsync(Cancellatio 阅读全文
posted @ 2022-04-27 12:18 广阔之海 阅读(2028) 评论(0) 推荐(0)
摘要: 一般来说,WebApi返回数据需要封装为固定格式,比如state、message、data三个属性,state返回状态,为true或false(也可用status返回状态码),message返回消息,如操作失败的异常信息,data用来返回操作结果。 /// <summary> /// 操作结果封装 阅读全文
posted @ 2022-04-26 16:13 广阔之海 阅读(2758) 评论(0) 推荐(0)
摘要: 在 Asp.Net Core WebApi中,使用方法过滤器拦截请求和响应,对请求和响应的内容进行日志记录,详见代码: using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsof 阅读全文
posted @ 2022-04-26 14:46 广阔之海 阅读(1149) 评论(0) 推荐(0)
摘要: async和await是C# 5.0新增加的关键字,提高了异步编程的易用性,请看以下示例: using System; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; namespace 阅读全文
posted @ 2022-04-25 17:01 广阔之海 阅读(79) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2022-01-22 09:18 广阔之海 阅读(684) 评论(0) 推荐(0)
摘要: 提供同步、异步方式执行请求的Http库,模仿axios风格,开源地址:https://gitee.com/lgyup/leaf-http。 使用方法: HttpClient httpClient = new HttpClient(); httpClient.BaseUrl = "http://loc 阅读全文
posted @ 2021-03-17 17:24 广阔之海 阅读(114) 评论(0) 推荐(0)
摘要: ************************************************************* * Halcon将裁剪后的图像还原为原始大小 * Author: LiGuangyu * Date: 2018-02-26 * 在Halcon的使用中,有时候需要对图像开窗,而测量时又需要还原为原始大小 *********************************... 阅读全文
posted @ 2018-02-26 14:07 广阔之海 阅读(3014) 评论(0) 推荐(0)
摘要: ************************************************************* * Halcon从某一个图片以指定区域绘制到另一个图像 * Author: LiGuangyu * Date: 2018-02-26 * 在Halcon中找了很多次都没找到这种算子,后来自己想出来的一个办法 *******************************... 阅读全文
posted @ 2018-02-26 13:56 广阔之海 阅读(9314) 评论(0) 推荐(1)
摘要: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Threading; using System.Windows.Forms; namespace... 阅读全文
posted @ 2017-12-07 11:43 广阔之海 阅读(449) 评论(0) 推荐(0)
摘要: 1、 直接调用C++类库中的公共方法 使用DllImport特性对方法进行调用,比如一个C++类库SampleCppWrapper.dll中的公共方法: __stdcall表示调用约定:参数都是从右向左通过堆栈传递, 函数调用在返回前要由被调用者清理堆栈。 在C#中,调用如下: 注意参数的类型,之后 阅读全文
posted @ 2017-07-04 13:18 广阔之海 阅读(40257) 评论(2) 推荐(10)