当集合为 null 时,代码如下: List<int>? _a = null; List<int>? _b = null; var a = _a?.Any() == false;[......]继续阅读

2022年8月6日 0条评论 3932点热度 1人点赞 痴者工良 阅读全文

When the collection is null, the code is as follows: List<int>? _a = null; List<int>? _b = null; var[......]继续阅读

2022年8月6日 0条评论 1514点热度 1人点赞 痴者工良 阅读全文

如下面代码: [ThreadStatic] private bool HasCreated = false; [ThreadStatic] private int Value = 0; void Main() { ThreadLocal<string> a = new Thre[......]继续阅读

2022年8月4日 0条评论 4645点热度 1人点赞 痴者工良 阅读全文

[ThreadStatic] private static bool HasCreated = false; [ThreadStatic] private static int Value = 0; void Main() { Console.WriteLine(Thread.Curren[......]继续阅读

2022年8月4日 0条评论 4349点热度 1人点赞 痴者工良 阅读全文

Directory Structure: └─templates └─consolesync └─content ├─.template.config ├──template.json └─AAA.Web.API ### Template Directory 1. Create an empty[......]继续阅读

2022年7月21日 0条评论 1870点热度 0人点赞 痴者工良 阅读全文

目录结构: └─templates └─consolesync └─content ├─.template.config ├──template.json └─AAA.Web.API 模板目录 1,随[......] 继续阅读

2022年7月21日 0条评论 13286点热度 0人点赞 痴者工良 阅读全文

When not using ASP.NET Core and without the FluentValidation framework, model validation can be implemented through the native API. public class A {[......]继续阅读

2022年7月20日 0条评论 3514点热度 2人点赞 痴者工良 阅读全文

在不使用 ASP.NET Core 时,也不使用 FluentValidation 这里框架,通过原生的 API 实现模型验证。 public class A { [EmailAddress] public string B { get; set; } } void Main() {[......]继续阅读

2022年7月20日 0条评论 3738点热度 2人点赞 痴者工良 阅读全文

Define the Converter: public class EnumStringConverter : JsonConverter<Enum> { public override bool CanConvert(Type objectType) { return obj[......]继续阅读

2022年7月18日 0条评论 5043点热度 4人点赞 痴者工良 阅读全文

定义转换器: public class EnumStringConverter : JsonConverter<Enum> { public override bool CanConvert(Type objectType) { return object[......]继续阅读

2022年7月18日 0条评论 5239点热度 4人点赞 痴者工良 阅读全文

在 .NET 官方的 Docker 镜像中,添加自定义工具链: FROM mcr.microsoft.com/dotnet/sdk:5.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \[......]继续阅读

2022年7月12日 0条评论 4092点热度 1人点赞 痴者工良 阅读全文

在 .NET 官方的 Docker 镜像中,添加自定义工具链: FROM mcr.microsoft.com/dotnet/sdk:5.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \[......]继续阅读

2022年7月12日 0条评论 4152点热度 1人点赞 痴者工良 阅读全文

public async Task ExecuteAsync(HttpContext context) { Context = context; Request = Context.Request;[......]继续阅读

2022年7月5日 0条评论 1884点热度 2人点赞 痴者工良 阅读全文

public async Task ExecuteAsync(HttpContext context) { Context = context; Request = Context.Request;[......]继续阅读

2022年7月5日 0条评论 2949点热度 2人点赞 痴者工良 阅读全文

private static readonly Encoding UTF8NoBOM = new UTF8Encoding( encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); [......] 继续阅读

2022年7月5日 0条评论 1616点热度 0人点赞 痴者工良 阅读全文

private static readonly Encoding UTF8NoBOM = new UTF8Encoding( encoderShouldEmitUTF8Identifier: false, throwOnInvali[......]继续阅读

2022年7月5日 0条评论 3788点热度 0人点赞 痴者工良 阅读全文

public async static Task (this IApplicationBuilder app) { app.ApplicationServices.GetRequiredService<ObjectAccessor<IApplicationBuilde[......]继续阅读

2022年6月24日 0条评论 1692点热度 1人点赞 痴者工良 阅读全文

public async static Task (this IApplicationBuilder app) { app.ApplicationServices.GetRequiredService<ObjectAccessor<IApplicationBuilder[......]继续阅读

2022年6月24日 0条评论 3835点热度 1人点赞 痴者工良 阅读全文

处理 Stream 的一些用法。 public static byte[] GetAllBytes(this Stream stream) { using (var memoryStream = new MemoryStream()) {[......]继续阅读

2022年6月24日 0条评论 3916点热度 0人点赞 痴者工良 阅读全文

Handling some usages of Stream. public static byte[] GetAllBytes(this Stream stream) { using (var memoryStream = new MemoryStream())[......]继续阅读

2022年6月24日 0条评论 4078点热度 0人点赞 痴者工良 阅读全文
1101112131429