public sealed class BitSequence : IMessage<BitSequence>, IEquatable<BitSequence>, IDeepCloneable<BitSequence>, IBufferMessage, IMessage
Reference documentation and code samples for the Firestore v1 API class BitSequence.
A sequence of bits, encoded in a byte array.
Each byte in the bitmap byte array stores 8 bits of the sequence. The only
exception is the last byte, which may store 8 or fewer bits. The padding
defines the number of bits of the last byte to be ignored as "padding". The
values of these "padding" bits are unspecified and must be ignored.
To retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0.
To retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0.
To retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0.
To retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0.
To retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0.
The "size" of a BitSequence (the number of bits it contains) is calculated
by this formula: (bitmap.length * 8) - padding.
The number of bits of the last byte in bitmap to ignore as "padding".
If the length of bitmap is zero, then this value must be 0.
Otherwise, this value must be between 0 and 7, inclusive.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version available for the \u003ccode\u003eBitSequence\u003c/code\u003e class is 3.10.0, but this page specifically documents version 3.8.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBitSequence\u003c/code\u003e is a class in the \u003ccode\u003eGoogle.Cloud.Firestore.V1\u003c/code\u003e namespace, representing a sequence of bits encoded in a byte array, and it implements interfaces such as \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBitSequence\u003c/code\u003e class uses a \u003ccode\u003ebitmap\u003c/code\u003e byte array to store the bit sequence, where each byte holds 8 bits, with the last byte possibly containing fewer bits, and the \u003ccode\u003epadding\u003c/code\u003e property specifies the number of padding bits to ignore.\u003c/p\u003e\n"],["\u003cp\u003eThe size of a \u003ccode\u003eBitSequence\u003c/code\u003e is calculated as \u003ccode\u003e(bitmap.length * 8) - padding\u003c/code\u003e, and individual bits can be retrieved using bitwise operations on the \u003ccode\u003ebitmap\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBitSequence\u003c/code\u003e class has two constructors, a default one and one that accepts another \u003ccode\u003eBitSequence\u003c/code\u003e as a parameter, and exposes two properties, \u003ccode\u003eBitmap\u003c/code\u003e which is of type \u003ccode\u003eByteString\u003c/code\u003e and \u003ccode\u003ePadding\u003c/code\u003e which is an integer.\u003c/p\u003e\n"]]],[],null,[]]