本文整理汇总了C#中Microsoft.VisualStudio.Debugger.Metadata.Type类的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.VisualStudio.Debugger.Metadata.Type类的具体用法?C# Microsoft.VisualStudio.Debugger.Metadata.Type怎么用?C# Microsoft.VisualStudio.Debugger.Metadata.Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Microsoft.VisualStudio.Debugger.Metadata.Type类属于命名空间,在下文中一共展示了Microsoft.VisualStudio.Debugger.Metadata.Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvalResultDataItem
public EvalResultDataItem(
string name,
Type typeDeclaringMember,
Type declaredType,
DkmClrValue value,
Expansion expansion,
bool childShouldParenthesize,
string fullName,
string childFullNamePrefixOpt,
ReadOnlyCollection<string> formatSpecifiers,
DkmEvaluationResultCategory category,
DkmEvaluationResultFlags flags,
string editableValue)
{
Debug.Assert(formatSpecifiers != null);
Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0);
this.NameOpt = name;
this.TypeDeclaringMember = typeDeclaringMember;
this.DeclaredType = declaredType;
this.Value = value;
this.ChildShouldParenthesize = childShouldParenthesize;
this.FullNameWithoutFormatSpecifiers = fullName;
this.ChildFullNamePrefix = childFullNamePrefixOpt;
this.FormatSpecifiers = formatSpecifiers;
this.Category = category;
this.EditableValue = editableValue;
this.Flags = flags | GetFlags(value) | ((expansion == null) ? DkmEvaluationResultFlags.None : DkmEvaluationResultFlags.Expandable);
this.Expansion = expansion;
}
示例2: SubstituteDynamicFlags
internal DynamicFlagsCustomTypeInfo SubstituteDynamicFlags(Type type, DynamicFlagsCustomTypeInfo originalDynamicFlags)
{
if (_typeDefinition == null)
{
return originalDynamicFlags;
}
var substitutedFlags = ArrayBuilder<bool>.GetInstance();
int f = 0;
foreach (Type curr in new TypeWalker(type))
{
if (curr.IsGenericParameter && curr.DeclaringType.Equals(_typeDefinition))
{
AppendFlagsFor(curr, substitutedFlags);
}
else
{
substitutedFlags.Add(originalDynamicFlags[f]);
}
f++;
}
var result = DynamicFlagsCustomTypeInfo.Create(substitutedFlags);
substitutedFlags.Free();
return result;
}
示例3: AppendEnumTypeAndName
private void AppendEnumTypeAndName(StringBuilder builder, Type typeToDisplayOpt, string name)
{
if (typeToDisplayOpt != null)
{
// We're showing the type of a value, so "dynamic" does not apply.
bool unused;
int index1 = 0;
int index2 = 0;
AppendQualifiedTypeName(
builder,
typeToDisplayOpt,
null,
ref index1,
null,
ref index2,
escapeKeywordIdentifiers: true,
sawInvalidIdentifier: out unused);
builder.Append('.');
AppendIdentifierEscapingPotentialKeywords(builder, name, sawInvalidIdentifier: out unused);
}
else
{
builder.Append(name);
}
}
示例4: AppendTupleElement
protected override void AppendTupleElement(
StringBuilder builder,
Type type,
string nameOpt,
ReadOnlyCollection<byte> dynamicFlags,
ref int dynamicFlagIndex,
ReadOnlyCollection<string> tupleElementNames,
ref int tupleElementIndex,
bool escapeKeywordIdentifiers,
out bool sawInvalidIdentifier)
{
sawInvalidIdentifier = false;
bool sawSingleInvalidIdentifier;
AppendQualifiedTypeName(
builder,
type,
dynamicFlags,
ref dynamicFlagIndex,
tupleElementNames,
ref tupleElementIndex,
escapeKeywordIdentifiers,
sawInvalidIdentifier: out sawSingleInvalidIdentifier);
Debug.Assert(!sawSingleInvalidIdentifier);
if (!string.IsNullOrEmpty(nameOpt))
{
builder.Append(' ');
AppendIdentifier(builder, escapeKeywordIdentifiers, nameOpt, out sawSingleInvalidIdentifier);
sawInvalidIdentifier |= sawSingleInvalidIdentifier;
}
}
示例5: AppendGenericTypeArgumentList
protected override void AppendGenericTypeArgumentList(
StringBuilder builder,
Type[] typeArguments,
int typeArgumentOffset,
DynamicFlagsCustomTypeInfo dynamicFlags,
ref int index,
int arity,
bool escapeKeywordIdentifiers,
out bool sawInvalidIdentifier)
{
sawInvalidIdentifier = false;
builder.Append('<');
for (int i = 0; i < arity; i++)
{
if (i > 0)
{
builder.Append(", ");
}
Type typeArgument = typeArguments[typeArgumentOffset + i];
bool sawSingleInvalidIdentifier;
AppendQualifiedTypeName(builder, typeArgument, dynamicFlags, ref index, escapeKeywordIdentifiers, out sawSingleInvalidIdentifier);
sawInvalidIdentifier |= sawSingleInvalidIdentifier;
}
builder.Append('>');
}
示例6: AppendQualifiedTypeName
/// <summary>
/// Append the qualified name (i.e. including containing types and namespaces) of a named,
/// pointer, or array type to <paramref name="builder"/>.
/// </summary>
/// <remarks>
/// Keyword strings are appended for primitive types (e.g. "int" for "System.Int32").
/// Question mark syntax is used for <see cref="Nullable{T}"/>.
/// No special handling is required for anonymous types - they are expected to be
/// emitted with <see cref="DebuggerDisplayAttribute.Type"/> set to "<Anonymous Type>.
/// This is fortunate, since we don't have a good way to recognize them in metadata.
/// Does not call itself (directly).
/// </remarks>
protected void AppendQualifiedTypeName(
StringBuilder builder,
Type type,
DynamicFlagsCustomTypeInfo dynamicFlags,
ref int index,
bool escapeKeywordIdentifiers,
out bool sawInvalidIdentifier)
{
Type originalType = type;
// Can have an array of pointers, but not a pointer to an array, so consume these first.
// We'll reconstruct this information later from originalType.
while (type.IsArray)
{
index++;
type = type.GetElementType();
}
int pointerCount = 0;
while (type.IsPointer)
{
var elementType = type.GetElementType();
if (elementType == null)
{
// Null for function pointers.
break;
}
index++;
pointerCount++;
type = elementType;
}
int nullableCount = 0;
Type typeArg;
while ((typeArg = type.GetNullableTypeArgument()) != null)
{
index++;
nullableCount++;
type = typeArg;
}
Debug.Assert(nullableCount < 2, "Benign: someone is nesting nullables.");
Debug.Assert(pointerCount == 0 || nullableCount == 0, "Benign: pointer to nullable?");
int oldLength = builder.Length;
AppendQualifiedTypeNameInternal(builder, type, dynamicFlags, ref index, escapeKeywordIdentifiers, out sawInvalidIdentifier);
string name = builder.ToString(oldLength, builder.Length - oldLength);
builder.Append('?', nullableCount);
builder.Append('*', pointerCount);
type = originalType;
while (type.IsArray)
{
AppendRankSpecifier(builder, type.GetArrayRank());
type = type.GetElementType();
}
}
示例7: GetArrayDisplayString
internal override string GetArrayDisplayString(Type lmrType, ReadOnlyCollection<int> sizes, ReadOnlyCollection<int> lowerBounds, ObjectDisplayOptions options)
{
Debug.Assert(lmrType.IsArray);
Type originalLmrType = lmrType;
// Strip off all array types. We'll process them at the end.
while (lmrType.IsArray)
{
lmrType = lmrType.GetElementType();
}
var pooled = PooledStringBuilder.GetInstance();
var builder = pooled.Builder;
builder.Append('{');
// We're showing the type of a value, so "dynamic" does not apply.
bool unused;
builder.Append(GetTypeName(new TypeAndCustomInfo(lmrType), escapeKeywordIdentifiers: false, sawInvalidIdentifier: out unused)); // NOTE: call our impl directly, since we're coupled anyway.
var numSizes = sizes.Count;
builder.Append('[');
for (int i = 0; i < numSizes; i++)
{
if (i > 0)
{
builder.Append(", ");
}
var lowerBound = lowerBounds[i];
var size = sizes[i];
if (lowerBound == 0)
{
builder.Append(FormatLiteral(size, options));
}
else
{
builder.Append(FormatLiteral(lowerBound, options));
builder.Append("..");
builder.Append(FormatLiteral(size + lowerBound - 1, options));
}
}
builder.Append(']');
lmrType = originalLmrType.GetElementType(); // Strip off one layer (already handled).
while (lmrType.IsArray)
{
builder.Append('[');
builder.Append(',', lmrType.GetArrayRank() - 1);
builder.Append(']');
lmrType = lmrType.GetElementType();
}
builder.Append('}');
return pooled.ToStringAndFree();
}
示例8: GetTypeName
/// <returns>The qualified name (i.e. including containing types and namespaces) of a named,
/// pointer, or array type.</returns>
internal string GetTypeName(Type type, bool escapeKeywordIdentifiers = false)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
var pooled = PooledStringBuilder.GetInstance();
AppendQualifiedTypeName(pooled.Builder, type, escapeKeywordIdentifiers);
return pooled.ToStringAndFree();
}
示例9: TypeVariablesExpansion
internal TypeVariablesExpansion(Type declaredType)
{
Debug.Assert(declaredType.IsGenericType);
Debug.Assert(!declaredType.IsGenericTypeDefinition);
var typeDef = declaredType.GetGenericTypeDefinition();
_typeParameters = typeDef.GetGenericArguments();
_typeArguments = declaredType.GetGenericArguments();
Debug.Assert(_typeParameters.Length == _typeArguments.Length);
Debug.Assert(Array.TrueForAll(_typeParameters, t => t.IsGenericParameter));
Debug.Assert(Array.TrueForAll(_typeArguments, t => !t.IsGenericParameter));
}
示例10: AppendEnumTypeAndName
private void AppendEnumTypeAndName(StringBuilder builder, Type typeToDisplayOpt, string name)
{
if (typeToDisplayOpt != null)
{
AppendQualifiedTypeName(builder, typeToDisplayOpt, escapeKeywordIdentifiers: true);
builder.Append('.');
AppendIdentifierEscapingPotentialKeywords(builder, name);
}
else
{
builder.Append(name);
}
}
示例11: AppendGenericTypeArgumentList
protected override void AppendGenericTypeArgumentList(StringBuilder builder, Type[] typeArguments, int typeArgumentOffset, int arity, bool escapeKeywordIdentifiers)
{
builder.Append('<');
for (int i = 0; i < arity; i++)
{
if (i > 0)
{
builder.Append(", ");
}
Type typeArgument = typeArguments[typeArgumentOffset + i];
AppendQualifiedTypeName(builder, typeArgument, escapeKeywordIdentifiers);
}
builder.Append('>');
}
示例12: AppendEnumTypeAndName
private void AppendEnumTypeAndName(StringBuilder builder, Type typeToDisplayOpt, string name)
{
if (typeToDisplayOpt != null)
{
// We're showing the type of a value, so "dynamic" does not apply.
int index = 0;
AppendQualifiedTypeName(builder, typeToDisplayOpt, default(DynamicFlagsCustomTypeInfo), ref index, escapeKeywordIdentifiers: true);
builder.Append('.');
AppendIdentifierEscapingPotentialKeywords(builder, name);
}
else
{
builder.Append(name);
}
}
示例13: DynamicFlagsMap
private DynamicFlagsMap(
Type typeDefinition,
DynamicFlagsCustomTypeInfo dynamicFlagsArray,
int[] startIndices)
{
Debug.Assert(typeDefinition != null);
Debug.Assert(startIndices != null);
Debug.Assert(typeDefinition.IsGenericTypeDefinition);
Debug.Assert(startIndices.Length == typeDefinition.GetGenericArguments().Length + 1);
_typeDefinition = typeDefinition;
_dynamicFlags = dynamicFlagsArray;
_startIndices = startIndices;
}
示例14: GetIrisTypeForLmrType
/// <summary>
/// Convert a type from the debugger's type system into Iris's type system
/// </summary>
/// <param name="lmrType">LMR Type</param>
/// <returns>Iris type</returns>
public static IrisType GetIrisTypeForLmrType(Type lmrType)
{
if (lmrType.IsPrimitive)
{
switch (lmrType.FullName)
{
case "System.Int32":
return IrisType.Integer;
case "System.Boolean":
return IrisType.Boolean;
}
}
else if (lmrType.IsArray)
{
if (lmrType.GetArrayRank() != 1)
return IrisType.Invalid;
IrisType elementType = GetIrisTypeForLmrType(lmrType.GetElementType());
if (elementType == IrisType.Invalid)
return IrisType.Invalid;
return elementType.MakeArrayType();
}
else if (lmrType.IsByRef)
{
IrisType elementType = GetIrisTypeForLmrType(lmrType.GetElementType());
if (elementType == IrisType.Invalid)
return IrisType.Invalid;
return elementType.MakeByRefType();
}
else if (lmrType.FullName.Equals("System.String"))
{
return IrisType.String;
}
// Unknown
return IrisType.Invalid;
}
示例15: AppendSpecialTypeName
protected override bool AppendSpecialTypeName(StringBuilder builder, Type type, bool escapeKeywordIdentifiers)
{
if (type.IsPredefinedType())
{
builder.Append(type.GetPredefinedTypeName()); // Not an identifier, does not require escaping.
return true;
}
if (type.IsGenericParameter)
{
AppendIdentifier(builder, escapeKeywordIdentifiers, type.Name);
return true;
}
if (type.IsVoid())
{
builder.Append("void"); // Not an identifier, does not require escaping.
return true;
}
return false;
}