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

            context.IncrementItemCount(memberCount);

            int memberIndex = -1;

            int firstRequiredMember;

            bool[] requiredMembers    = GetRequiredMembers(classContract, out firstRequiredMember);
            bool   hasRequiredMembers = (firstRequiredMember < memberCount);
            int    requiredIndex      = hasRequiredMembers ? firstRequiredMember : memberCount;

            while (XmlObjectSerializerReadContext.MoveToNextElement(xmlReader))
            {
                int idx;                 // used as in "switch (idx)" in the original source.
                if (hasRequiredMembers)
                {
                    idx = context.GetMemberIndexWithRequiredMembers(xmlReader, memberNames, memberNamespaces, memberIndex, (int)requiredIndex, extensionData);
                }
                else
                {
                    idx = context.GetMemberIndex(xmlReader, memberNames, memberNamespaces, memberIndex, extensionData);
                }

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

            if (hasRequiredMembers)
            {
                if (requiredIndex < memberCount)
                {
                    XmlObjectSerializerReadContext.ThrowRequiredMemberMissingException(xmlReader, memberIndex, requiredIndex, memberNames);
                }
            }
        }