/// /// Gets the value and applies bitmask /// Shifts return value to line up with mask /// /// The value. /// public UInt64 GetMaskedValue(UInt64 value) { BitArray ba = new BitArray(this.bitMask); int maskCount = 0; foreach(bool testBit in ba) { if (testBit) break; maskCount++; } byte[] temp = new byte[8]; bitMask.CopyTo(temp, 0); UInt64 mask = BitConverter.ToUInt64(bitMask, 0); UInt64 maskedValue = (value | mask) >> maskCount; }