ITLDG.BitConverterExtend 1.0.3

dotnet add package ITLDG.BitConverterExtend --version 1.0.3                
NuGet\Install-Package ITLDG.BitConverterExtend -Version 1.0.3                
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="ITLDG.BitConverterExtend" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ITLDG.BitConverterExtend --version 1.0.3                
#r "nuget: ITLDG.BitConverterExtend, 1.0.3"                
#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.
// Install ITLDG.BitConverterExtend as a Cake Addin
#addin nuget:?package=ITLDG.BitConverterExtend&version=1.0.3

// Install ITLDG.BitConverterExtend as a Cake Tool
#tool nuget:?package=ITLDG.BitConverterExtend&version=1.0.3                

ITLDG.BitConverterExtend

BitConverter 的大端模式扩展,额外增加了一些常用方法

结果对照

类型 BitConverter ITLDG.BitConverterExtend 还原方法
Char a 61-00 00-61 ToCharByBigEndian
Double 2.5 00-00-00-00-00-00-04-40 40-04-00-00-00-00-00-00 ToDoubleByBigEndian
Int16(short) 99 63-00 00-63 ToInt16ByBigEndian
Int32(int) 9999 0F-27-00-00 00-00-27-0F ToInt32ByBigEndian
Int64(long) 999999999 FF-C9-9A-3B-00-00-00-00 00-00-00-00-3B-9A-C9-FF ToInt64ByBigEndian
Single(float) 2.5 00-00-20-40 40-20-00-00 ToSingleByBigEndian
UInt16(ushort) 99 63-00 00-63 ToUInt16ByBigEndian
UInt32(uint) 9999 0F-27-00-00 00-00-27-0F ToUInt32ByBigEndian
UInt64(ulong) 999999999 FF-C9-9A-3B-00-00-00-00 00-00-00-00-3B-9A-C9-FF ToUInt64ByBigEndian

自适应返回数字

方法 参数 结果
ToIntByBigEndian 00 01 Int16 类型数字
ToIntByBigEndian 00 01 02 03 Int32 类型数字
ToIntByBigEndian 00 01 02 03 04 05 06 07 Int64 类型数字
ToUIntByBigEndian 00 01 UInt16 类型数字
ToUIntByBigEndian 00 01 02 03 UInt32 类型数字
ToUIntByBigEndian 00 01 02 03 04 05 06 07 UInt64 类型数字

扩展方法

演示字节数组为:E4 BD A0 E5 A5 BD

方法 结果 备注
GetString_BIN 111001001011110110100000111001011010010110111101 字节数组转二进制字符串
GetString_HEX E4 BD A0 E5 A5 BD 字节数组转十六进制字符串,对应GetBytes_HEX
GetString_UTF8 你好 字节数组使用UTF-8编码解码字符串,对应GetBytes_UTF8

HEX 字符串的方法

方法 参数 结果 备注
GetString_HEX2ASCII 01 02 30 31 30 32 将 HEX 字符串转换为 ASCII 码的 HEX 字符串
GetString_ASCII2HEX 30 31 30 32 01 02 将 ASCII 码的 HEX 字符串转换为 HEX 字符串,对应GetString_HEX2ASCII
RemoveHexSpace 30 31 30 32 30313032 移除 HEX 字符串中的空格、制表符、连接符

更多方法

更多的方法和参数未一一列出,等待大家发现和 Pr

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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ITLDG.BitConverterExtend:

Package Downloads
ITLDG.DataCheck

常用的串口校验方式

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 235 12/15/2023
1.0.2 418 8/29/2023
1.0.0 239 3/11/2023