NuGet Package: https://www.nuget.org/packages/BitFields/
The analyzer in this package currently does not support packages.config format.
Type definition:
structRgb555{enumBitFields{B=5,G=5,R=5,}}Quick Action:
Generated code:
usingBitFields;partialstructRgb555{publicushortValue;privateconstintBShift=0;privateconstushortBMask=unchecked((ushort)((1U<<5)-(1U<<0)));publicBit5B{get=>(Bit5)((Value&BMask)>>BShift);set=>Value=unchecked((ushort)((Value&~BMask)|((((ushort)value)<<BShift)&BMask)));}privateconstintGShift=5;privateconstushortGMask=unchecked((ushort)((1U<<10)-(1U<<5)));publicBit5G{get=>(Bit5)((Value&GMask)>>GShift);set=>Value=unchecked((ushort)((Value&~GMask)|((((ushort)value)<<GShift)&GMask)));}privateconstintRShift=10;privateconstushortRMask=unchecked((ushort)((1U<<15)-(1U<<10)));publicBit5R{get=>(Bit5)((Value&RMask)>>RShift);set=>Value=unchecked((ushort)((Value&~RMask)|((((ushort)value)<<RShift)&RMask)));}}
