KyCommonExtend 1.5.0

dotnet add package KyCommonExtend --version 1.5.0
                    
NuGet\Install-Package KyCommonExtend -Version 1.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KyCommonExtend" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KyCommonExtend" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="KyCommonExtend" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KyCommonExtend --version 1.5.0
                    
#r "nuget: KyCommonExtend, 1.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package KyCommonExtend@1.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=KyCommonExtend&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=KyCommonExtend&version=1.5.0
                    
Install as a Cake Tool

Install-Package Oclean.Core.Ability.Common // ============== 1. 基础类型转换 ==============

object numObj = "123.456"; int intVal = numObj.ToInt(); // 输出:123(小数自动向下取整)

string strVal = numObj.ToNullString(); // 输出:"123.456"

string strNoSpace = " test ".ToNullStringNoSpace(); // 输出:"test"

bool boolVal = "1".ToBool(); // 输出:true

long longVal = "1234567890".ToLong(); // 输出:1234567890

double doubleVal = "3.14".ToDouble(); // 输出:3.14

decimal decimalVal = "99.99".ToDecimal(); // 输出:99.99

float floatVal = "1.23".ToFloat(); // 输出:1.23f

DateTime? dateVal = "2025-11-27".ToDateTime(); // 输出:2025-11-27 00:00:00

// ============== 2. 日期处理 ============== DateTime now = DateTime.Now;

DateTime monday = now.GetMonday(); // 获取当前日期所在周的周一(仅日期部分)

long timeStamp = now.ToTimeStamp(); // 转换为Unix时间戳(秒级,基于1970-01-01)

int weekNum = now.WeekOfYear(); // 获取当前日期是一年中的第几周(周一为周起始)

// ============== 3. MAC地址转换 ==============

long macLong = ObjectExtends.MacStringToLong("00:1A:2B:3C:4D:5E");

string macStr = ObjectExtends.MacLongToString(macLong); // 输出:"00:1A:2B:3C:4D:5E"

// ============== 4. 64进制转换 ==============

long str64Val = "bUI6zOLZTrj".ToStr64ToLong(); // 自定义64进制字符串转long

// ==============5. 16进制字符串转Byte ==============

byte byteVal = "1A2B3C".ToBrushByte(2); // 输出:0x2B

// ============== 6. 加密解密工具(SafetyHelper) ==============

// -------------------- SHA256加密 -------------------- string sha256Result = SafetyHelper.SHA256Encrypt("原始数据", "加密密钥"); // HMACSHA256加密,返回Base64字符串

// -------------------- MD5加密 -------------------- string md5Upper = SafetyHelper.MD5Encrypt32("测试数据"); // 32位大写MD5 string md5Lower = SafetyHelper.MD5Encrypt("测试数据"); // 32位小写MD5

// -------------------- 异或加密/解密 -------------------- string xorEncrypt = SafetyHelper.XOREncrypt("需要加密的内容"); // 异或加密 string xorDecrypt = SafetyHelper.XORDecrypt(xorEncrypt); // 异或解密

// -------------------- AES加密/解密 -------------------- string aesEncrypt = SafetyHelper.AESEncrypt("待加密内容"); // 默认密钥AES加密 string aesDecrypt = SafetyHelper.AESDecrypt(aesEncrypt); // 默认密钥AES解密

// -------------------- DES加密/解密 -------------------- string desEncrypt = SafetyHelper.DESEncrypt("密钥", "待加密内容"); // DES加密 string desDecrypt = SafetyHelper.DESDecrypt("密钥", desEncrypt); // DES解密

// -------------------- SHA1加密 -------------------- string sha1Result = SafetyHelper.SHA1Encrypt("加密内容"); // SHA1加密

// -------------------- APP用户密码专用加密/解密 -------------------- string appPassEncrypt = SafetyHelper.EncryptAppUserPass("明文密码", "密钥"); // APP密码加密 string appPassDecrypt = SafetyHelper.DecryptAppUserPass(appPassEncrypt, "密钥"); // APP密码解密

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0 114 4/21/2026
1.4.0 127 1/14/2026
1.3.0 455 12/10/2025
1.2.1 201 11/27/2025
1.2.0 195 11/27/2025
1.1.0 198 11/27/2025
1.0.0 209 11/6/2025