Beispiel #1
0
 /// <summary>
 /// Print the value of an expression item.
 /// </summary>
 /// <param name="item">The expression item.</param>
 private void PrintValue(ExpressionItem item)
 {
     if (item is AssignmentOperatorItem)
     {
         //If the expression was an assignment display the new varaible name and its value.
         string variableName = ((AssignmentOperatorItem)item).VariableName;
         lstResultList.Items.Add(String.Format("  {1} = {0}", item.Value, variableName));
     }
     else
     {
         //Otherwise, store the result in 'answer'.
         lstResultList.Items.Add(String.Format("  answer = {0}", item.Value));
         //Save the result in the variable 'answer'
         resolver.GetReference("answer").Value = item.Value;
     }
 }