When the collection is null, the code is as follows: List<int>? _a = null; List<int>? _b = null; var a = _a?.Any() == false; var b = _a?.Any() == true; var c = _b?.Any() == false; var d = _b?.Any() == true; When th[......] 继续阅读

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

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

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

[ThreadStatic] private static bool HasCreated = false; [ThreadStatic] private static int Value = 0; void Main() { Console.WriteLine(Thread.CurrentThread.ManagedThreadId); ThreadLocal<string> a = new ThreadLocal<string>(() => { if (HasCreated) re…

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

如下面代码: [ThreadStatic] private bool HasCreated = false; [ThreadStatic] private int Value = 0; void Main() { ThreadLocal<string> a = new ThreadLocal<string>(() => { if (HasCreated) return Value.ToString(); else { Value = Thread.CurrentThread.[....…

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

Docker Deployment: docker run -d \ --name=calibre-web \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Europe/London \ -e DOCKER_MODS=linuxserver/mods:universal-calibre `#optional` \ -e OAUTHLIB_RELAX_TOKEN_SCOPE=1 `#optional` \ -p 8083:8083 \ -v /data/book/config:/confi…

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

Docker 部署: docker run -d \ --name=calibre-web \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Europe/London \ -e DOCKER_MODS=linuxserver/mods:universal-calibre <code>#optional</code> \ -e OAUTHLIB_RELAX_TOKEN_SCOPE=1 <code>#optional</code> \ -p 8…

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

Execute fdisk -l to find the required disk. As you can see, this is a blank disk. Start executing commands to create a partition on the blank disk. fdisk /dev/sdc First, enter n. Command action <- Select the type of partition to create e extended <- Exte…

2022年7月28日 2条评论 5362点热度 1人点赞 痴者工良 阅读全文

执行 fdisk -l 会发现需要的磁盘。 可以看到这是一个空白盘。 开始执行命令将空白磁盘创建分区。 fdisk /dev/sdc 先输入 n。 ommand action <- 选择要创建的分区类型 e extended <- 扩展分区 p primary partition (1-4) <- 主分区 输入 p,再输入 1,剩下选项直接回车。 输入 w ,保存并退出。 格式化并设置磁盘系统: mkfs.ext4 /dev/sdc1 挂载 mount /dev/sdc1 /data/ 查看磁盘挂…

2022年7月28日 2条评论 5814点热度 1人点赞 痴者工良 阅读全文

Directory Structure: └─templates └─consolesync └─content ├─.template.config ├──template.json └─AAA.Web.API ### Template Directory 1. Create an empty directory at will, then create one inside it, and create the template directory under templates. The name of th…

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

目录结构: └─templates └─consolesync └─content ├─.template.config ├──template.json └─AAA.Web.API 模板目录 1,随便创建一个空目录,然后在里面创建一个 ,在 templates 下创建模板目录,这个命令起名要可以随意。S 目录。 2,在 templates 下创建模板目录,这个命令起名要可以随意。这个就是模板存储的目录。 3,模板目录创建两个目录,分别是 content 和 license,license[......] 继续阅读

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

When not using ASP.NET Core and without the FluentValidation framework, model validation can be implemented through the native API. public class A { [EmailAddress] public string B { get; set; } } void Main() { var result = new List<ValidationResult>(); v…

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

在不使用 ASP.NET Core 时,也不使用 FluentValidation 这里框架,通过原生的 API 实现模型验证。 public class A { [EmailAddress] public string B { get; set; } } void Main() { var result = new List<ValidationResult>(); var a = new A { B = "aa.com" }; var validationContext = new Validati…

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

Define the Converter: public class EnumStringConverter : JsonConverter<Enum> { public override bool CanConvert(Type objectType) { return objectType.IsEnum; } public override Enum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions o…

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

定义转换器: public class EnumStringConverter : JsonConverter<Enum> { public override bool CanConvert(Type objectType) { return objectType.IsEnum; } public override Enum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var v…

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

在 .NET 官方的 Docker 镜像中,添加自定义工具链: FROM mcr.microsoft.com/dotnet/sdk:5.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \ ssh-client \ && rm -rf /var/lib/apt/lists/* 在 Docker 容器中使用 Docker 命令: -u root -v /var/run/docker.sock:/va…

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

在 .NET 官方的 Docker 镜像中,添加自定义工具链: FROM mcr.microsoft.com/dotnet/sdk:5.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \ ssh-client \ && rm -rf /var/lib/apt/lists/* 在 Docker 容器中使用 Docker 命令: -u root -v /var/run/docker.sock:/va…

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

public async Task ExecuteAsync(HttpContext context) { Context = context; Request = Context.Request; Response = Context.Response; var buffer = new MemoryStream(); Output = new StreamWriter(buffer, UTF8NoBOM, 4096, leaveOpen:[......]继续阅读

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

public async Task ExecuteAsync(HttpContext context) { Context = context; Request = Context.Request; Response = Context.Response; var buffer = new MemoryStream(); Output = new StreamWriter(buffer, UTF8NoBOM, 4096, leaveOpen:[......]继续阅读

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

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

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

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

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