protected void ReflectionReadMember(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, ClassDataContract classContract, ref object obj, int memberIndex, DataMember[] members)
        {
            DataMember dataMember = members[memberIndex];

            Debug.Assert(dataMember != null);
            if (dataMember.IsGetOnlyCollection)
            {
                var memberValue = ReflectionGetMemberValue(obj, dataMember);
                context.StoreCollectionMemberInfo(memberValue);
                ReflectionReadValue(xmlReader, context, dataMember, GetClassContractNamespace(classContract));
            }
            else
            {
                context.ResetCollectionMemberInfo();
                var        value      = ReflectionReadValue(xmlReader, context, dataMember, classContract.StableName.Namespace);
                MemberInfo memberInfo = dataMember.MemberInfo;
                Debug.Assert(memberInfo != null);

                ReflectionSetMemberValue(ref obj, value, dataMember);
            }
        }
        int ReadMembers(int index, ClassDataContract classContract, bool [] requiredMembers, ref int memberIndex, ref int requiredIndex)
        {
            int memberCount = (classContract.BaseContract == null) ? 0 : ReadMembers(index, classContract.BaseContract, requiredMembers,
                                                                                     ref memberIndex, ref requiredIndex);

            if (memberCount <= index && index < memberCount + classContract.Members.Count)
            {
                DataMember dataMember = classContract.Members [index - memberCount];
                Type       memberType = dataMember.MemberType;
                if (dataMember.IsRequired)
                {
                    int nextRequiredIndex = index + 1;
                    for (; nextRequiredIndex < requiredMembers.Length; nextRequiredIndex++)
                    {
                        if (requiredMembers [nextRequiredIndex])
                        {
                            break;
                        }
                    }
                    requiredIndex = nextRequiredIndex;
                }

                if (dataMember.IsGetOnlyCollection)
                {
                    var value = CodeInterpreter.GetMember(dataMember.MemberInfo, objectLocal);
                    context.StoreCollectionMemberInfo(value);
                    ReadValue(memberType, dataMember.Name, classContract.StableName.Namespace);
                }
                else
                {
                    var value = ReadValue(memberType, dataMember.Name, classContract.StableName.Namespace);
                    CodeInterpreter.SetMember(dataMember.MemberInfo, objectLocal, value);
                }
                memberIndex = index;
            }
            return(memberCount + classContract.Members.Count);
        }