/// <summary>
        /// Returns the details of the variable container's children.  If empty, returns an empty array.
        /// </summary>
        /// <returns></returns>
        public override VariableDetailsBase[] GetChildren(ILogger logger)
        {
            var variablesArray = new VariableDetailsBase[this.children.Count];

            this.children.Values.CopyTo(variablesArray, 0);
            return(variablesArray);
        }
        /// <summary>
        /// Evaluates a variable expression in the context of the stopped
        /// debugger.  This method decomposes the variable expression to
        /// walk the cached variable data for the specified stack frame.
        /// </summary>
        /// <param name="variableExpression">The variable expression string to evaluate.</param>
        /// <param name="stackFrameId">The ID of the stack frame in which the expression should be evaluated.</param>
        /// <returns>A VariableDetails object containing the result.</returns>
        public VariableDetailsBase GetVariableFromExpression(string variableExpression, int stackFrameId)
        {
            // Break up the variable path
            string[] variablePathParts = variableExpression.Split('.');

            VariableDetailsBase resolvedVariable           = null;
            IEnumerable <VariableDetailsBase> variableList = this.variables;

            foreach (var variableName in variablePathParts)
            {
                if (variableList == null)
                {
                    // If there are no children left to search, break out early
                    return(null);
                }

                resolvedVariable =
                    variableList.FirstOrDefault(
                        v =>
                        string.Equals(
                            v.Name,
                            variableExpression,
                            StringComparison.InvariantCultureIgnoreCase));

                if (resolvedVariable != null &&
                    resolvedVariable.IsExpandable)
                {
                    // Continue by searching in this variable's children
                    variableList = this.GetVariables(resolvedVariable.Id);
                }
            }

            return(resolvedVariable);
        }
        /// <summary>
        /// Gets the list of variables that are children of the scope or variable
        /// that is identified by the given referenced ID.
        /// </summary>
        /// <param name="variableReferenceId"></param>
        /// <returns>An array of VariableDetails instances which describe the requested variables.</returns>
        public VariableDetailsBase[] GetVariables(int variableReferenceId)
        {
            VariableDetailsBase[] childVariables;

            VariableDetailsBase parentVariable = this.variables[variableReferenceId];

            if (parentVariable.IsExpandable)
            {
                childVariables = parentVariable.GetChildren();
                foreach (var child in childVariables)
                {
                    // Only add child if it hasn't already been added.
                    if (child.Id < 0)
                    {
                        child.Id = this.nextVariableId++;
                        this.variables.Add(child);
                    }
                }
            }
            else
            {
                childVariables = new VariableDetailsBase[0];
            }

            return(childVariables);
        }
        /// <summary>
        /// Gets the list of variables that are children of the scope or variable
        /// that is identified by the given referenced ID.
        /// </summary>
        /// <param name="variableReferenceId"></param>
        /// <returns>An array of VariableDetails instances which describe the requested variables.</returns>
        public VariableDetailsBase[] GetVariables(int variableReferenceId)
        {
            VariableDetailsBase[] childVariables;

            VariableDetailsBase parentVariable = this.variables[variableReferenceId];
            if (parentVariable.IsExpandable)
            {
                childVariables = parentVariable.GetChildren();
                foreach (var child in childVariables)
                {
                    // Only add child if it hasn't already been added.
                    if (child.Id < 0)
                    {
                        child.Id = this.nextVariableId++;
                        this.variables.Add(child);
                    }
                }
            }
            else
            {
                childVariables = new VariableDetailsBase[0];
            }

            return childVariables;
        }
 /// <summary>
 /// Returns the details of the variable container's children.  If empty, returns an empty array.
 /// </summary>
 /// <returns></returns>
 public override VariableDetailsBase[] GetChildren()
 {
     var variablesArray = new VariableDetailsBase[this.children.Count];
     this.children.Values.CopyTo(variablesArray, 0);
     return variablesArray;
 }