分类: c#

20 篇文章

Swagger 配置
# 进行参数修改 builder.Services.AddSwaggerGen(opt => {}); 修改标题 opt.SwaggerDoc("v1", new OpenApiInfo { Title = "Test01", Version = "v1", }); 在 header…
设置 task 为 STA 模式
因为要运行窗口代码,必须使用 STA 模式,而有一些代码又需要 async/await 方式 一 推荐,因为可以传入一个异步函数,并可以扩展为带返回值 # 调用 await this.RunWithStaTaskAsync(this.AppRun); private async Task RunWithStaTaskAsync(Func<Ta…
CuttingEdge.Conditions 替代
Ardalis.GuardClauses https://www.nuget.org/packages/Ardalis.GuardClauses
.net 健康度检查
[官方手册] https://learn.microsoft.com/zh-cn/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-9.0 [一个第三方库,包括各种服务的检测] https://github.com/Xabaril/AspNetCore.Diagnostics.Hea…
.http 文件使用
使用 Visual Studio 2022 中的 .http 文件 | Microsoft Learn .http 文件语法 请求:HTTP 请求的格式为 HTTPMethod URL HTTPVersion,其中 HTTP 方法可以是 GET、POST、PUT 等,URL 是请求的目标地址,HTTPVersion 是可选的。 示例: GET ht…
.net 调用 AI 例子
#load "AppLib" #load "seqlog" // https://learn.microsoft.com/en-us/dotnet/core/extensions/artificial-intelligence?tabs=dotnet-cli // https://www.bilibili.c…
.net 编译时将警告视为错误
<PropertyGroup> <!-- 将警告视为错误 --> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <!-- 忽略添加高危 nuget 包时的警告(会变成错误,导致编译失败) --> <NuGetAudit>…
.net 性能计数器指标
.net 性能计数器指标 https://learn.microsoft.com/en-us/dotnet/framework/debug-trace-profile/performance-counters https://www.cnblogs.com/cuihongyu3503319/p/13564334.html