Take the 2-minute tour ×

I want to use this expression parser.

I import this code that is on the site:

using System;
using System.Collections;
using info.lundin.Math;
// some other imports

public class Test 
  public static void Main( String[] args )
    // Instantiate the parser
    ExpressionParser parser = new ExpressionParser();
    // Create a hashtable to hold values
    Hashtable h = new Hashtable();
    // Add variables and values to hashtable
    h.Add( "x", 1.ToString() );
    h.Add( "y", 2.ToString() );
    // Parse and write the result
    double result = parser.Parse( "xcos(y)", h );

but it says that the namespace Hashtable could not be found. i google it and i found out that Hashtables are not included in Silverlight and i should use a dictionary.

But when i use dictionary it gives my an error that says: cannot convert from System.Collections.Generic.Dictionary<string,string> to System.Collections.Hashtable

Any suggestions?

share|improve this question
You should upgrade the parser to use a dictionary instead. –  Daniel A. White Feb 1 '12 at 17:49
What's the code look like that gives you the "cannot convert from System.Collections.Generic.Dictionary to System.Collections.Hashtable" error? –  Gunther Fox Feb 1 '12 at 17:51

2 Answers 2

I would modify the source code in the parser program so that it also is compatible with Silverlight(i.e. change any hashtable implementations into dictionary implementations)

share|improve this answer

Hashtables and ArrayLists are not included in the silverlight. So you cant use it.

You can use generic collections—List and Dictionary instead of HashTables and ArrayLists.

share|improve this answer

Your Answer


