To improve project code quality, analyzers are often installed. However, these analyzers occupy 10MB when generating project program files. Since these DLLs are unnecessary, they should not be left taking up space. You can use the built-in Property Manager in …

2020年3月6日 2条评论 5017点热度 1人点赞 痴者工良 阅读全文

为了提高项目代码质量,所以往往会安装分析器。 但是呢,这些分析器在生成项目程序文件时,占了 10MB。这些 dll 用不上的,没必要留着占空间。 可以使用 VS 自带的属性管理器去除 也可以手动 打开项目 .csproj 文件,找到如下的两个节点 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <CodeAnalysisRuleSet&g…

2020年3月6日 2条评论 4989点热度 1人点赞 痴者工良 阅读全文

%# %# is used for formatted output, typically in the form %#p. %x is used to display in hexadecimal format, but the output format may vary depending on the environment. %p displays a hexadecimal representation of a system address as an integer within the range…

2020年3月5日 0条评论 3417点热度 1人点赞 痴者工良 阅读全文

%# %# 表示格式化输出,一般这样使用 %#p。 %x 表示输出 16 进制格式,但是受环境影响,格式会变化。 %p 表示输出 16 进制 系统寻址范围为取值范围的整数。 有多少位就打印多少位。32位系统一般是 8 位,64 位系统一般 16 位。不足 8 位自动补 0 ; 例如 int 4 个字节,那么 %p 打印输出共 32 位 2 进制表示的值,不足位数自动补 0 。主要用来输出地址、指针。 %# 表示格式化输出,16 进制自动加上 0x。 指针地址的字节数 指针地址都是使用 4 个字节存储。 char *…

2020年3月5日 0条评论 3369点热度 1人点赞 痴者工良 阅读全文

The analyzer is named miniprofiler, and the official website is https://miniprofiler.com/dotnet/. It can be directly integrated into the code and run tests after deployment. It supports performance analysis for the following frameworks: ASP.NET ASP.NET Core Co…

2020年3月2日 2条评论 4242点热度 2人点赞 痴者工良 阅读全文

分析器名为 miniprofiler,官网地址为 https://miniprofiler.com/dotnet/ 可以直接放到代码中,发布后运行测试。 支持以下框架的性能分析: ASP.NET ASP.NET Core Console .NET Console .NET Core EF6 EF Core SQL [......] 继续阅读

2020年3月2日 2条评论 4246点热度 2人点赞 痴者工良 阅读全文

C language does not have a bool type, but many places require true and false. How to solve this? In C language, 1 and 0, or non-zero and 0, are generally used to represent true and false. For example: int a = 6666; int b = 161616; printf("%s", a &…

2020年3月2日 2条评论 102点热度 0人点赞 痴者工良 阅读全文

C语言中没有 bool 类型,但是很多地方都需要 true 和 flase,怎么解决呢? C 语言 一般使用 1 和 0 或 非0 和 0 表示 true 和 flase。 例如 int a = 6666; int b = 161616; printf("%s",a & b?"true":"flase"); a&b 的结果是一个数字,只要大于 0 或 小于 0 ,即为 true。 而且 C# 中,?: 运算符,左侧条件必须是 bool ,不…

2020年3月2日 2条评论 4199点热度 0人点赞 痴者工良 阅读全文

Binary numbers, Any number bitwise ANDed with N ones results in itself; or ORed with N zeros results in itself. Any number bitwise ANDed with N zeros results in N zeros; any number bitwise ORed with N ones results in N ones. Bitwise ANDing with N ones. 1 0 1 0…

2020年3月1日 1条评论 5739点热度 1人点赞 痴者工良 阅读全文

二进制数, 任何数与 N 个 1 进行按位与,结果等于自身;或者与 N 个 0 进行按位或,结果等于自身。 任何数与 N 个 0 进行按位与,结果是 N 个 0;任何数与 N 个 1 进行按位或,结果是 N 个 1; 与 N 个 1 按位与。 1 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 可以通过此特性来获取某几位上的数。 获取某几位上的数字 例如获取一个 int 类型 8-11 位的数据。 C#版 int num, mark; …

2020年3月1日 1条评论 5725点热度 1人点赞 痴者工良 阅读全文

RuntimeInformation and Environment Fetching Information Reflection to Fetch Information Fetching Property Values Reflection to Fetch Attribute Values Fetching a Property's Value and Alias Reflection to Fetch Information Usage Summary The author’s nine articles…

2020年2月29日 0条评论 104点热度 0人点赞 痴者工良 阅读全文

RuntimeInformation、Environment 获取信息 反射获取信息 获取属性值 反射获取特性值 获取某个属性的值以及别名 反射获取信息 使用 总结 [......] 继续阅读

2020年2月29日 0条评论 2984点热度 0人点赞 痴者工良 阅读全文

背景: When debugging tests, it's necessary to use NSwag.AspNetCore to provide swagger services, but it's not needed for formal release deployment. The NSwag.AspNetCore library file reaches 6MB. This can be handled in the project file using the condition Conditio…

2020年2月28日 2条评论 98点热度 2人点赞 痴者工良 阅读全文

背景: 调试测试 Debug 时需要使用 NSwag.AspNetCore ,提供 swagger 服务,但是正式发布部署,不需要用到。 NSwag.AspNetCore 的库文件达到6MB。 可以在项目文件中使用如下条件 Condition="'$(Configuration)'=='DEBUG'" 示例: <PackageReference Condition="'$(Configuration)'=='D…

2020年2月28日 2条评论 4619点热度 2人点赞 痴者工良 阅读全文

This query is particularly useful for multi-table joins, as in join queries, some field data may be empty, and directly returning null is not very user-friendly. SELECT eg.GroupId, eg.GroupName, egl.EquipGroupListId, egl.StaNo, egl.EquipNo, (SELECT IFNULL((SEL…

2020年2月27日 0条评论 4746点热度 0人点赞 痴者工良 阅读全文

这个查询对于多表联查特别有用,因为连接查询,有可能部分字段数据为空,直接返回null不太友好。 下面使用三个表来演示 SELECT eg.GroupId, eg.GroupName, egl.EquipGroupListId, egl.StaNo, egl.EquipNo, (SELECT IFNULL((SELECT equip_nm FROM Equip WHERE equip_no = egl.EquipNo), '此设备已被删除' )) AS EquipNm FROM EquipGrou…

2020年2月27日 0条评论 4734点热度 0人点赞 痴者工良 阅读全文

如果写 C# 时,使用了分析器,很可能会提示 string.ToString() 的行为可能因当前用户的区域设置而异 这里针对某些字符/字符串转换时出现的问题,做个列表。 IFormatProvider 这个接口用于实现字符串如何格式化转为数值类型。一般来说666、0.666 这样的数没问题,但是使用数学符号等情况、全球化字符差异,可能会出错。 IFormatProvider 正是为了解决这些问题。 Convert.ToInt32 、 string.ToString()将字符串/Object转为值类型时,会提示 需…

2020年2月26日 4条评论 108点热度 3人点赞 痴者工良 阅读全文

如果写 C# 时,使用了分析器,很可能会提示 string.ToString() 的行为可能因当前用户的区域设置而异 这里针对某些字符/字符串转换时出现的问题,做个列表。 IFormatProvider 这个接口用于实现字符串如何格式化转为数值类型。一般来说666、0.666 这样的数没问题,但是使用数学符号等情况、全球化字符差异,可能会出错。 IFormatProvider 正是为了解决这些问题。 Convert.ToInt32 、 string.ToString()将字符串/Object转为值类型时,会提示 需…

2020年2月26日 4条评论 5085点热度 3人点赞 痴者工良 阅读全文

.NET Core does not have the functionality to obtain CPU usage and other information on Linux, so don't hold your breath. static void Main(string[] args) { Console.WriteLine("System Runtime Status"); var proc = Process.GetCurrentProcess();[......]继续阅读

2020年2月26日 0条评论 92点热度 6人点赞 痴者工良 阅读全文

.NET Core 中没有获取 Linux 的 CPU使用率等信息的功能,死心吧。 static void Main(string[] args) { Console.WriteLine("系统运行情况"); var proc = Process.GetCurrentProcess(); var mem = proc.WorkingSet64; var cpu = proc.TotalProcessorTime; Conso[......]继续阅读

2020年2月26日 0条评论 6231点热度 6人点赞 痴者工良 阅读全文
1353637383954