Пример #1
0
        public void SetVariables(CalcVar[] allvar)
        {
            m_calcEngine.Variables.Clear();

            foreach (CalcVar var in allvar)
            {
                m_calcEngine.Variables.Add(var.name, var.value);
            }
        }
Пример #2
0
        public CalcVar[] GetAllVariables()
        {
            CalcVar[] allvar = new CalcVar[m_calcEngine.Variables.Count];
            int i = 0;

            if (m_calcEngine.Variables.ContainsKey("ans"))
            {
                allvar[i] = new CalcVar();
                allvar[i].name = "ans";
                allvar[i].value = m_calcEngine.Variables["ans"];
                i++;
            }

            foreach ( string key in m_calcEngine.Variables.Keys)
            {
                if (key.Equals("ans"))
                    continue;

                allvar[i] = new CalcVar();

                allvar[i].name = key;
                allvar[i].value = m_calcEngine.Variables[key];
                i++;
            }
            return allvar;
        }