/// <summary> /// Gets the Array Item for the specified indexes /// </summary> /// <param name="indexes">Which indexes to get the Array Item for.</param> /// <returns>The Value for the given indexes.</returns> public MDbgValue GetArrayItem(params int[] indexes) { if (!IsArrayType) { throw new MDbgValueException("Type is not array type"); } CorValue value = Dereference(CorValue, null); CorArrayValue av = value.CastToArrayValue(); Debug.Assert(av != null); if (av.Rank != indexes.Length) { throw new MDbgValueException("Invalid number of dimensions."); } StringBuilder sb = new StringBuilder("["); for (int i = 0; i < indexes.Length; ++i) { if (i != 0) { sb.Append(","); } sb.Append(indexes[i]); } sb.Append("]"); MDbgValue v = new MDbgValue(Process, sb.ToString(), av.GetElement(indexes)); return(v); }
/// <summary> Returns an element of an array </summary> public Value GetArrayElement(uint[] indices) { try { return(new Value(this.AppDomain, CorArrayValue.GetElement(indices))); } catch (ArgumentException) { throw new GetValueException("Invalid array index"); } }
public object GetElement(int[] indices) { return(new CorValRef(delegate { // If we have a zombie state array, reload it. if (!obj.IsValid) { obj.Reload(); array = CorObjectAdaptor.GetRealObject(ctx, obj) as CorArrayValue; } return array != null ? array.GetElement(indices) : null; })); }
public object GetElement(int[] indices) { return(new CorValRef(delegate { if (array != null) { return array.GetElement(indices); } else { return null; } })); }
// May be called later ICorDebugValue GetCorValueOfArrayElement(int[] indices) { if (indices.Length != ArrayRank) { throw new GetValueException("Given indicies do not have the same dimension as array."); } if (!this.ArrayDimensions.IsIndexValid(indices)) { throw new GetValueException("Given indices are out of range of the array"); } return(CorArrayValue.GetElement(indices)); }
public object GetElement(int[] indices) { return(new CorValRef(delegate { CorArrayValue array = CorObjectAdaptor.GetRealObject(ctx, obj) as CorArrayValue; if (array != null) { return array.GetElement(indices); } else { return null; } })); }
// May be called later ICorDebugValue GetCorValueOfArrayElement(uint[] indices) { if (!IsArray) { throw new CannotGetValueException("The value is not an array"); } if (indices.Length != ArrayRank) { throw new CannotGetValueException("Given indicies do not have the same dimension as array."); } for (int i = 0; i < indices.Length; i++) { if (indices[i] > ArrayDimensions[i]) { throw new CannotGetValueException("Given indices are out of range of the array"); } } return(CorArrayValue.GetElement(indices)); }