Natasha 群5月11日吹水备忘录 HTTP/2 新特性 关于 HTTP/2 HTTP/2 并不是对 HTTP 协议的彻底重写,HTTP/2 关注的重点是性能、低延迟、降低网络和服务器资源使用等;与 HTTP 的请求方法、状态代码和语义等是相同的。 HTTP/2 由两个部分组成: 超文本传输协议[......] 继续阅读
Natasha 群5月11日吹水备忘录 HTTP/2 新特性 关于 HTTP/2 HTTP/2 并不是对 HTTP 协议的彻底重写,HTTP/2 关注的重点是性能、低延迟、降低网络和服务器资源使用等;与 HTTP 的请求方法、状态代码和语义等是相同的。 HTTP/2 由两个部分组成: 超文本传输协议[......] 继续阅读
// 二进制位数长度 private int binaryLength = 16; // 将数字转为 N 位二进制,并且前面补足 0 private byte[] ToBinary(int num) {[......]继续阅读
// Length of binary bits private int binaryLength = 16; // Convert number to N-bit binary and pad with 0s at the front[......]继续阅读
Using inheritance has the drawback that adding functionality requires changes in both the upper and lower layers. At the same time, it is necessary to[......] 继续阅读
The static class constructor cannot have access modifiers, cannot be called externally, and has no parameters; The static class constructor is trigge[......] 继续阅读
静态类的构造函数不能加上访问修饰符,也不能被外界调用,也没有参数; 静态类的构造函数在创建第一个实例或调用第一个成员前触发调用; 静态类不能被继承; 而单例模式的类型,是一个普通的类型,可以被实例化,能够有多个构造函数;能够被继承; [......] 继续阅读
假设有一段代码原本在 Windows 上运行,继承了接口 IDo,但是现在要迁移到 Linux 运行,可是某些地方不兼容,而同事已经将代码写好了,但是没有继承在 Windows 下运行的 IDo 接口,又不能改动以前的代码,必须保证都兼容。 原代码如下: // 只接受 Ido 的类型[......]继续阅读
除了手动实现单例模式,也可以使用 Lazy 泛型实现单例模式。 public sealed class Singleton { private static readonly Lazy lazy = new Lazy(() => new Singleton());[......]继续阅读
Besides manually implementing the singleton pattern, you can also use the Lazy generic type to implement the singleton pattern. public sealed clas[......]继续阅读
工厂模式和抽象工厂模式,都是避免调用者直接 new 一个新的实例,预先将创建逻辑编写在工厂代码中,并且对实例进行和一些配置,然后分配调用者使用。 原有代码: HttpRequest 作用是检查网址是否能够访问以及健康状态。 using System; using System.Collections[......]继续阅读
Factory Method and Abstract Factory patterns both avoid direct instantiation of new instances by the caller. Instead, they encapsulate the creation lo[......] 继续阅读
方法一: csproj文件中,加上 方法二: .runtimeconfig.json 文件加上 { "runtimeOptions": { "configProperties": { "System.Globalization.Invariant&[......] 继续阅读
Method 1: Add the following to the .csproj file: <ItemGroup> <RuntimeHostConfigurationOption Include="System.Globalization.Invariant[......]继续阅读
/// <summary> /// base64转为图片存储到本地 /// </summary> /// <param name="base64"></param>[......]继续阅读
下面是一张图片的 base64 编码 下面代码是很久前写的了,暂时不改,为了速度,请修改字符串操作部分的代码。 /// /// base64转为图片存储到本地 /// /// /// ///[......]继续阅读
解决方法: 使用 RandomNumberGenerator 来生成随机数。 https://docs.microsoft.com/zh-cn/dotnet/api/system.security.cryptography.randomnumbergenerator?view=netcore-3.1[......] 继续阅读
Solution: Use RandomNumberGenerator to generate random numbers. https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.randomnumberg[......] 继续阅读
Tip: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111[......] 继续阅读