/// <summary>
        /// Indexer allowing the Variable Collection to be accessed using array syntax.
        /// </summary>
        /// <param name="varName">The variable name that you want to access.</param>
        /// <returns>The variable.</returns>
        public MDbgDebuggerVar this[string varName]
        {
            get
            {
                Debug.Assert(varName != null && varName.StartsWith("$"));
                if (varName == null || !varName.StartsWith("$"))
                    throw new ArgumentException("Wrong name of debugger variable.");

                // handle special read-only debugger vars
                MDbgDebuggerVar dv;
                dv = RetrieveSpecialVar(varName);
                if (dv != null)
                    return dv;

                string istr = String.Intern(varName);
                if (m_debuggerVars.Contains(istr))
                    return (MDbgDebuggerVar) m_debuggerVars[istr];
                else
                {
                    dv = new MDbgDebuggerVar(varName);
                    m_debuggerVars.Add(istr, dv);
                    return dv;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Indexer allowing the Variable Collection to be accessed using array syntax.
        /// </summary>
        /// <param name="varName">The variable name that you want to access.</param>
        /// <returns>The variable.</returns>
        public MDbgDebuggerVar this[string varName]
        {
            get
            {
                Debug.Assert(varName != null && varName.StartsWith("$"));
                if (varName == null || !varName.StartsWith("$"))
                {
                    throw new ArgumentException("Wrong name of debugger variable.");
                }

                // handle special read-only debugger vars
                MDbgDebuggerVar dv;
                dv = RetrieveSpecialVar(varName);
                if (dv != null)
                {
                    return(dv);
                }

                string istr = String.Intern(varName);
                if (m_debuggerVars.Contains(istr))
                {
                    return((MDbgDebuggerVar)m_debuggerVars[istr]);
                }
                else
                {
                    dv = new MDbgDebuggerVar(varName);
                    m_debuggerVars.Add(istr, dv);
                    return(dv);
                }
            }
        }
        IEnumerator IEnumerable.GetEnumerator()
        {
            var ret = new MDbgDebuggerVar[m_debuggerVars.Count + g_specialVars.Length];
            m_debuggerVars.Values.CopyTo(ret, 0);
            for (int i = 0; i < g_specialVars.Length; ++i)
            {
                MDbgDebuggerVar d = RetrieveSpecialVar(g_specialVars[i]);
                Debug.Assert(d != null); // RetrieveSpecialVar needs to succedd for every var in g_specialVars
                ret[m_debuggerVars.Count + i] = d;
            }

            Array.Sort(ret);
            return ret.GetEnumerator();
        }
Ejemplo n.º 4
0
        IEnumerator IEnumerable.GetEnumerator()
        {
            var ret = new MDbgDebuggerVar[m_debuggerVars.Count + g_specialVars.Length];

            m_debuggerVars.Values.CopyTo(ret, 0);
            for (int i = 0; i < g_specialVars.Length; ++i)
            {
                MDbgDebuggerVar d = RetrieveSpecialVar(g_specialVars[i]);
                Debug.Assert(d != null); // RetrieveSpecialVar needs to succedd for every var in g_specialVars
                ret[m_debuggerVars.Count + i] = d;
            }

            Array.Sort(ret);
            return(ret.GetEnumerator());
        }