本文整理汇总了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;
}
}
示例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;
}
}
}
示例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;
}
示例4: CheckExpectedArrayLength
private void CheckExpectedArrayLength(XmlObjectSerializerReadContext context, int arrayLength)
{
context.IncrementItemCount(arrayLength);
}
示例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;
}
示例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);
}