BitSupport 1.2.0
dotnet add package BitSupport --version 1.2.0
NuGet\Install-Package BitSupport -Version 1.2.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="BitSupport" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BitSupport --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BitSupport, 1.2.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.
// Install BitSupport as a Cake Addin #addin nuget:?package=BitSupport&version=1.2.0 // Install BitSupport as a Cake Tool #tool nuget:?package=BitSupport&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BitSupportFlags Attribute
// Enum Flag Create
[BitSupportFlags]
public enum MACHINE
{
POWER,
RIGHT,
TOP,
LIGHT,
TEMP,
RUN,
SOUND,
ETC
}
- Generating Bytes with Flag Data
var MACHINEFlags = MACHINE.POWER.ToFlags() | MACHINE.RIGHT.ToFlags(); // 또는 MACHINEFlags.POWER | MACHINEFlags.RIGHT
byte byteValue = MACHINEFlags .ToByte ();
- Creating Enums via Byte
byte byteValue = 0x05;
var enumData = byteValue.ToEnum<MACHINE> (); // 또는 data.ToEnum<MACHINEFlags>
- Only Enum values in
{enum}Flags
can use HasFlags
byte byteValue = 0x05;
var enumData = byteValue.ToEnum<MACHINE> ();
if (enumData.HasFlags (MACHINEFlags.POWER | MACHINEFlags.TOP))
{
Console.WriteLine("Byte data containing both “POWER, TOP”.)
}
- Enum values in
{enum}Flags
are available as multi for data, single for non-Flags
byte byteValue = 0x05;
var enumData = byteValue.ToEnum<MACHINE> ();
if (enumData.HasAnyFlags(MACHINEFlags.POWER | MACHINEFlags.TOP))
{
Console.WriteLine("POWER, TOP"이 포함된 Byte 데이터입니다.)
}
if (enumData.HasAnyFlags(MACHINE.POWER))
{
Console.WriteLine("POWER"이 포함된 Byte 데이터입니다.)
}
``` Enum values in `{enum}Flags` are available as multi for data, single for non-Flags
```csharp
byte byteValue = 0x05;
var enumData = byteValue.ToEnum<MACHINE> ();
if (enumData.HasNotFlags(MACHINEFlags.NONE | MACHINEFlags.LIGHT))
{
Console.WriteLine("NONE , LIGHT"는 포함되어있지않습니다.)
}
if (enumData.HasNotFlags(MACHINE.POWER))
{
Console.WriteLine("POWER"는 포함되어있지않습니다.)
}
BitState Attribute
[BitState(typeof(BitSupportFlags)]
public class Machine
{
}
public void Main()
{
Machine machine = new Machine();
// 상태 제어
machine.SetState(BitSupportFlags.POWER); // Power On
machine.SetState(BitSupportFlags.RIGHT); // Machine Right Move
machine.RemoveState(BitSupportFlags.RIGHT); // Machine Right Move Remove
// 상태 확인
Console.WriteLine($"Is the device powered on? : {machine.IsState(BitSupportFlags.POWER)}");
Console.WriteLine($"Is the device moving to the right? : {machine.IsState(BitSupportFlags.RIGHT)}");
Console.WriteLine($"What is the status of the device in bytes? : {machine.GetByte()}");
}
/* output:
Is the device powered on? : true
Is the device moving to the right? : false
What is the status of the device in bytes? : 0x01
*/
[BitState] can be used in Flags as well as BitSupportFlags.
Product | Versions 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
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.2.0 | 0 | 11/25/2024 |
1.1.5-preview1 | 0 | 11/25/2024 |
1.1.4-preview1 | 0 | 11/25/2024 |
1.1.3-preview1 | 0 | 11/25/2024 |
1.1.2-preview1 | 0 | 11/25/2024 |
1.1.1-preview1 | 0 | 11/25/2024 |
1.0.0 | 37 | 11/19/2024 |