本文整理汇总了C#中Microsoft.VisualStudio.Debugger.Metadata.Type.GetTupleCardinalityIfAny方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.VisualStudio.Debugger.Metadata.Type.GetTupleCardinalityIfAny方法的具体用法?C# Microsoft.VisualStudio.Debugger.Metadata.Type.GetTupleCardinalityIfAny怎么用?C# Microsoft.VisualStudio.Debugger.Metadata.Type.GetTupleCardinalityIfAny使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.Debugger.Metadata.Type
的用法示例。
在下文中一共展示了Microsoft.VisualStudio.Debugger.Metadata.Type.GetTupleCardinalityIfAny方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendTupleElements
private void AppendTupleElements(
StringBuilder builder,
Type type,
int cardinality,
ReadOnlyCollection<byte> dynamicFlags,
ref int dynamicFlagIndex,
ReadOnlyCollection<string> tupleElementNames,
ref int tupleElementIndex,
bool escapeKeywordIdentifiers,
out bool sawInvalidIdentifier)
{
sawInvalidIdentifier = false;
#if DEBUG
int lastNameIndex = tupleElementIndex + cardinality;
#endif
int nameIndex = tupleElementIndex;
builder.Append('(');
bool any = false;
while (true)
{
tupleElementIndex += cardinality;
var typeArguments = type.GetGenericArguments();
int nTypeArgs = typeArguments.Length;
Debug.Assert(nTypeArgs > 0);
Debug.Assert(nTypeArgs <= TypeHelpers.TupleFieldRestPosition);
int nFields = Math.Min(nTypeArgs, TypeHelpers.TupleFieldRestPosition - 1);
for (int i = 0; i < nFields; i++)
{
if (any)
{
builder.Append(", ");
}
bool sawSingleInvalidIdentifier;
var name = CustomTypeInfo.GetTupleElementNameIfAny(tupleElementNames, nameIndex);
nameIndex++;
AppendTupleElement(
builder,
typeArguments[i],
name,
dynamicFlags,
ref dynamicFlagIndex,
tupleElementNames,
ref tupleElementIndex,
escapeKeywordIdentifiers,
sawInvalidIdentifier: out sawSingleInvalidIdentifier);
sawInvalidIdentifier |= sawSingleInvalidIdentifier;
any = true;
}
if (nTypeArgs < TypeHelpers.TupleFieldRestPosition)
{
break;
}
Debug.Assert(!DynamicFlagsCustomTypeInfo.GetFlag(dynamicFlags, dynamicFlagIndex));
dynamicFlagIndex++;
type = typeArguments[nTypeArgs - 1];
cardinality = type.GetTupleCardinalityIfAny();
}
#if DEBUG
Debug.Assert(nameIndex == lastNameIndex);
#endif
builder.Append(')');
}