Reputation: 1
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?
Upvotes: 0
Views: 1516
Reputation: 3456
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.
Upvotes: 0
Reputation: 423
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)
Upvotes: 2