当前位置: 首页>>代码示例>>C#>>正文


C# XmlObjectSerializerReadContext.IncrementItemCount方法代码示例

本文整理汇总了C#中XmlObjectSerializerReadContext.IncrementItemCount方法的典型用法代码示例。如果您正苦于以下问题:C# XmlObjectSerializerReadContext.IncrementItemCount方法的具体用法?C# XmlObjectSerializerReadContext.IncrementItemCount怎么用?C# XmlObjectSerializerReadContext.IncrementItemCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlObjectSerializerReadContext的用法示例。


在下文中一共展示了XmlObjectSerializerReadContext.IncrementItemCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReflectionReadMembers

 private void ReflectionReadMembers(object obj, XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces)
 {
     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 : -1;
     int index = -1;
     while (true)
     {
         if (!XmlObjectSerializerReadContext.MoveToNextElement(xmlReader))
         {
             return;
         }
         if (hasRequiredMembers)
         {
             index = context.GetMemberIndexWithRequiredMembers(xmlReader, memberNames, memberNamespaces, memberIndex, requiredIndex, null);
         }
         else
         {
             index = context.GetMemberIndex(xmlReader, memberNames, memberNamespaces, memberIndex, null);
         }
         ReflectionReadMember(obj, index, xmlReader, context, memberNames, memberNamespaces);
         memberIndex = index;
         requiredIndex = index + 1;
     }
 }
开发者ID:SGuyGe,项目名称:corefx,代码行数:29,代码来源:ReflectionXmlFormatReader.cs

示例2: ReflectionReadMembers

        protected override void ReflectionReadMembers(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString[] memberNames, XmlDictionaryString[] memberNamespaces, ClassDataContract classContract, ref object obj)
        {
            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 : -1;
            DataMember[] members = new DataMember[memberCount];
            int reflectedMemberCount = ReflectionGetMembers(classContract, members);
            Debug.Assert(reflectedMemberCount == memberCount, "The value returned by ReflectionGetMembers() should equal to memberCount.");

            while (true)
            {
                if (!XmlObjectSerializerReadContext.MoveToNextElement(xmlReader))
                {
                    return;
                }
                if (hasRequiredMembers)
                {
                    memberIndex = context.GetMemberIndexWithRequiredMembers(xmlReader, memberNames, memberNamespaces, memberIndex, requiredIndex, null);
                }
                else
                {
                    memberIndex = context.GetMemberIndex(xmlReader, memberNames, memberNamespaces, memberIndex, null);
                }

                // GetMemberIndex returns memberNames.Length if member not found
                if (memberIndex < members.Length)
                {
                    ReflectionReadMember(xmlReader, context, classContract, ref obj, memberIndex, members);
                    requiredIndex = memberIndex + 1;
                }
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:36,代码来源:ReflectionXmlFormatReader.cs

示例3: TryReadDoubleArray

        internal bool TryReadDoubleArray(XmlObjectSerializerReadContext context,
#endif   
            XmlDictionaryString itemName, XmlDictionaryString itemNamespace,
            int arrayLength, out double[] array)
        {
            if (dictionaryReader == null)
            {
                array = null;
                return false;
            }

            if (arrayLength != -1)
            {
                CheckExpectedArrayLength(context, arrayLength);
                array = new double[arrayLength];
                int read = 0, offset = 0;
                while ((read = dictionaryReader.ReadArray(itemName, itemNamespace, array, offset, arrayLength - offset)) > 0)
                {
                    offset += read;
                }
                CheckActualArrayLength(arrayLength, offset, itemName, itemNamespace);
            }
            else
            {
                array = DoubleArrayHelperWithDictionaryString.Instance.ReadArray(
                    dictionaryReader, itemName, itemNamespace, GetArrayLengthQuota(context));
                context.IncrementItemCount(array.Length);
            }
            return true;
        }
开发者ID:jsalvadorp,项目名称:corefx,代码行数:30,代码来源:XmlReaderDelegator.cs

示例4: CheckExpectedArrayLength

 private void CheckExpectedArrayLength(XmlObjectSerializerReadContext context, int arrayLength)
 {
     context.IncrementItemCount(arrayLength);
 }
开发者ID:jsalvadorp,项目名称:corefx,代码行数:4,代码来源:XmlReaderDelegator.cs

示例5: TryReadDecimalArray

 internal bool TryReadDecimalArray(XmlObjectSerializerReadContext context, XmlDictionaryString itemName, XmlDictionaryString itemNamespace, int arrayLength, out decimal[] array)
 {
     if (this.dictionaryReader == null)
     {
         array = null;
         return false;
     }
     if (arrayLength != -1)
     {
         this.CheckExpectedArrayLength(context, arrayLength);
         array = new decimal[arrayLength];
         int num = 0;
         int offset = 0;
         while ((num = this.dictionaryReader.ReadArray(itemName, itemNamespace, array, offset, arrayLength - offset)) > 0)
         {
             offset += num;
         }
         this.CheckActualArrayLength(arrayLength, offset, itemName, itemNamespace);
     }
     else
     {
         array = DecimalArrayHelperWithDictionaryString.Instance.ReadArray(this.dictionaryReader, itemName, itemNamespace, this.GetArrayLengthQuota(context));
         context.IncrementItemCount(array.Length);
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:XmlReaderDelegator.cs

示例6: CheckExpectedArrayLength

        void CheckExpectedArrayLength(XmlObjectSerializerReadContext context, int arrayLength)
        {
#if NO
            int readerArrayLength;
            if (dictionaryReader.TryGetArrayLength(out readerArrayLength))
            {
                if (readerArrayLength != arrayLength)
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.ArraySizeXmlMismatch, arrayLength, readerArrayLength)));
            }
#endif
            context.IncrementItemCount(arrayLength);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:XmlReaderDelegator.cs


注:本文中的XmlObjectSerializerReadContext.IncrementItemCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。