// Object graph visualizer: collection support temp disabled (porting to new NRefactory). /* * /// <summary> * /// Creates an expression which, when evaluated, creates a List<T> in the debugee * /// filled with contents of IEnumerable<T> from the debugee. * /// </summary> * /// <param name="iEnumerableVariable">Expression for IEnumerable variable in the debugee.</param> * /// <param name="itemType"> * /// The generic argument of IEnumerable<T> that <paramref name="iEnumerableVariable"/> implements.</param> * public static Expression CreateDebugListExpression(Expression iEnumerableVariable, DebugType itemType, out DebugType listType) * { * // is using itemType.AppDomain ok? * listType = DebugType.CreateFromType(itemType.AppDomain, typeof(System.Collections.Generic.List<>), itemType); * var iEnumerableType = DebugType.CreateFromType(itemType.AppDomain, typeof(IEnumerable<>), itemType); * // explicitely cast the variable to IEnumerable<T>, where T is itemType * Expression iEnumerableVariableExplicitCast = new CastExpression(iEnumerableType.GetTypeReference() , iEnumerableVariable, CastType.Cast); * return new ObjectCreateExpression(listType.GetTypeReference(), iEnumerableVariableExplicitCast.SingleItemList()); * }*/ /// <summary> /// Evaluates 'new List<T>(iEnumerableValue)' in the debuggee. /// </summary> public static Value CreateListFromIEnumerable(Value iEnumerableValue) { ParameterizedType iEnumerableType; IType itemType; if (!iEnumerableValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType)) { throw new GetValueException("Value is not IEnumerable"); } return(ValueNode.CreateListFromIEnumerable(iEnumerableType, iEnumerableValue).GetPermanentReferenceOfHeapValue()); }