随笔分类 - C#
摘要:BenchmarkWatch.NET 介绍 BenchmarkWatch.NET 是为 DOTNET 平台快速定位代码运行耗时所设计, 优化代码执行效率, 快速分析代码质量的分析工具. 支持版本: net45 netstandard2.0 netstandard2.1 net6.0 net7.0 安
阅读全文
摘要:FFmpegs.NET This is a project that plans to build FFmpegs.NET dynamic libraries, it's call FFmpeg API on .NET Platform. 这是一个FFmpegs.NET的动态库,支持在 .NET 平
阅读全文
摘要:看图 代码 using System; namespace Cmd { class Program { public static void Main(params string[] args) { Loader.Read(); Loader.Native = null; GC.Collect();
阅读全文
摘要:请注意 RuntimeInformation 支持 .netstandard2.0 以上的版本 using System; using System.Linq; using System.Runtime.InteropServices; Console.WriteLine(Environment.O
阅读全文
摘要:Append 追加不换行 AppendLine 追加并换行, 注意 → 先追加再换行.
阅读全文
摘要:向 hexstring 转 var bytes = Encoding.ASCII.GetBytes("adjdkfk"); var hex = Convert.ToHexString(bytes); var bs = Convert.FromHexString(hex); 向 其它 base64 等
阅读全文
摘要:直接上代码比较好 using System; using System.Collections.Generic; using System.Threading.Tasks; namespace src { public class Program { public static async Task
阅读全文
摘要:Unix time 表示自1970年1月1日01T00:00: 00Z (1970:00:00:00:00:,上午 12:00 AM UTC) 的秒数。 它不会考虑闰秒的时间。 此方法首先将当前实例转换为 UTC,然后再返回其 Unix 时间。 对于 1970-01-01T00:00:00Z 之前的
阅读全文
摘要:[TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { // var isIp = IPAddress.TryParse("220.181.38.150", out var _); var addre
阅读全文
摘要:using System; using System.Threading; namespace Cmd { class Program { static void Main(string[] args) { var asynclocal = new AsyncLocal<int>(); var th
阅读全文
摘要:xx.csproj true 允许不安全代码和指针 <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net5.0</TargetFramework> <Al
阅读全文
摘要:很多时候需要调用其它语言生成的动态库,那么 c# 如何调用动态库呢 下面简单介绍 C# 调用 c 语言生成的动态库 func.c int add(int num1,int num2) { return num1 + num2; } 编译生成动态库文件 gcc -fPIC -shared func.c
阅读全文
摘要:问题一 .csproj 项目包含静态文件,构建拷贝到输出文件目录 比如我想把项目根目录下 wwwroot 下的所有文件拷贝到输出目录 <ItemGroup> <None Remove="wwwroot\**" /> </ItemGroup> <ItemGroup> <Content Include=
阅读全文
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 5 namespace Microestc.PaginatedList 6 { 7 public class PaginatedList<TResul
阅读全文
摘要:解密加密源码 1 using System; 2 using System.Security.Cryptography; 3 using System.Text; 4 5 namespace Wechat 6 { 7 public static class Security 8 { 9 public
阅读全文
摘要:简单介绍,直接官方文档 https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.2 以下两个输出显示了两个请求的结果: 第一个请求: 控制器操作: 暂时性:d23
阅读全文

浙公网安备 33010602011771号