int ICorDebugEval2.NewParameterizedArray(ICorDebugType pElementType, uint rank, ref uint dims, ref uint lowBounds) { CorElementType type; ICorDebugClass cls; pElementType.GetType(out type); pElementType.GetClass(out cls); return(((ICorDebugEval)this).NewArray(type, cls, rank, dims, lowBounds)); }
int ICorDebugEval2.CreateValueForType(ICorDebugType pType, out ICorDebugValue ppValue) { CorElementType type; ICorDebugClass cls; pType.GetType(out type); pType.GetClass(out cls); return(((ICorDebugEval)this).CreateValue(type, cls, out ppValue)); }
int ICorDebugEval2.NewParameterizedArray(ICorDebugType pElementType, uint rank, ref uint dims, ref uint lowBounds) { CorElementType type; ICorDebugClass cls; pElementType.GetType(out type); pElementType.GetClass(out cls); return ((ICorDebugEval)this).NewArray(type, cls, rank, dims, lowBounds); }
public static ITypeReference ToTypeReference(this ICorDebugType corType, Process process) { switch ((CorElementType)corType.GetTheType()) { case CorElementType.VOID: return(KnownTypeReference.Void); case CorElementType.BOOLEAN: return(KnownTypeReference.Boolean); case CorElementType.CHAR: return(KnownTypeReference.Char); case CorElementType.I1: return(KnownTypeReference.SByte); case CorElementType.U1: return(KnownTypeReference.Byte); case CorElementType.I2: return(KnownTypeReference.Int16); case CorElementType.U2: return(KnownTypeReference.UInt16); case CorElementType.I4: return(KnownTypeReference.Int32); case CorElementType.U4: return(KnownTypeReference.UInt32); case CorElementType.I8: return(KnownTypeReference.Int64); case CorElementType.U8: return(KnownTypeReference.UInt64); case CorElementType.R4: return(KnownTypeReference.Single); case CorElementType.R8: return(KnownTypeReference.Double); case CorElementType.STRING: return(KnownTypeReference.String); case CorElementType.PTR: return(new PointerTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process))); case CorElementType.BYREF: return(new ByReferenceTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process))); case CorElementType.VALUETYPE: case CorElementType.CLASS: // Get generic arguments List <ITypeReference> genericArguments = new List <ITypeReference>(); foreach (ICorDebugType t in corType.EnumerateTypeParameters().GetEnumerator()) { genericArguments.Add(t.ToTypeReference(process)); } var module = process.GetModule(corType.GetClass().GetModule()); ITypeReference typeDefinitionReference = ToTypeDefinitionReference(module, corType.GetClass().GetToken()); if (genericArguments.Count > 0) { return(new ParameterizedTypeReference(typeDefinitionReference, genericArguments)); } else { return(typeDefinitionReference); } case CorElementType.ARRAY: return(new ArrayTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process), (int)corType.GetRank())); case CorElementType.GENERICINST: throw new NotSupportedException(); case CorElementType.I: return(KnownTypeReference.IntPtr); case CorElementType.U: return(KnownTypeReference.UIntPtr); case CorElementType.OBJECT: return(KnownTypeReference.Object); case CorElementType.SZARRAY: return(new ArrayTypeReference(corType.GetFirstTypeParameter().ToTypeReference(process))); case CorElementType.CMOD_REQD: case CorElementType.CMOD_OPT: return(corType.GetFirstTypeParameter().ToTypeReference(process)); default: throw new InvalidOperationException("Invalid value for CorElementType"); } }
int ICorDebugEval2.CreateValueForType(ICorDebugType pType, out ICorDebugValue ppValue) { CorElementType type; ICorDebugClass cls; pType.GetType( out type ); pType.GetClass( out cls ); return ((ICorDebugEval)this).CreateValue(type, cls, out ppValue); }