void ReadMembers(ClassDataContract classContract, ExtensionDataObject extensionData)
        {
            int memberCount = classContract.MemberNames.Length;

            context.IncrementItemCount(memberCount);

            int memberIndex = -1;

            // JSON intrinsic part.
            BitFlagsGenerator expectedElements = new BitFlagsGenerator(memberCount);

            byte [] requiredElements = new byte [expectedElements.GetLocalCount()];
            SetRequiredElements(classContract, requiredElements);
            SetExpectedElements(expectedElements, 0 /*startIndex*/);

            while (XmlObjectSerializerReadContext.MoveToNextElement(xmlReader))
            {
                int idx;                 // used as in "switch (idx)" in the original source.
                idx = context.GetJsonMemberIndex(xmlReader, memberNames, memberIndex, extensionData);

                if (memberCount > 0)
                {
                    ReadMembers(idx, classContract, expectedElements, ref memberIndex);
                }
            }

            if (!CheckRequiredElements(expectedElements, requiredElements))
            {
                XmlObjectSerializerReadContextComplexJson.ThrowMissingRequiredMembers(objectLocal, memberNames, expectedElements.LoadArray(), requiredElements);
            }
        }