.Net开发中不太常用的DLL及用法




GBK,GB2312编码

  
// System.Text.Encoding.CodePages
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var Encoding = Encoding.GetEncoding("GBK");

获取操作系统

#if NET6_0_OR_GREATER
                        OperatingSystem.IsWindows();
#else
                        System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
#endif

OperatingSystem.IsBrowser();

.NET6忽略上传文件大小限制

builder.WebHost.UseKestrel(so =>
{
    so.Limits.MaxRequestBodySize = null;
});

SQLite 加密,使用微软驱动可以实现加密,

普通的可视化工具不能打开,可以使用https://github.com/sqlitebrowser/sqlitebrowser/releases/download/v3.12.2/DB.Browser.for.SQLite-3.12.2-win64.zip

dotnet remove package Microsoft.Data.Sqlite
dotnet add package Microsoft.Data.Sqlite.Core
dotnet add package SQLitePCLRaw.bundle_e_sqlcipher
C