public Object FindBestMethod(Object dispatch1, Object dispatch2)
        {
            Object method = null;
            //BinOpList methods = null;
            //BinOpKey key = new BinOpKey(dispatch1.GetType(),dispatch2.GetType());
            //try to find in cache
            Type t1 = dispatch1.GetType();
            Type t2 = dispatch2.GetType();

            //method = findCachedMethod(key);
            method = findCachedMethod(t1, t2);
            if (method != null)
            {
                return(method);
            }
            //try to find type
            //BinOpList methods = (BinOpList)findBestMatch(key.t1,methodLists);
            BinOpList methods = (BinOpList)findBestMatch(t1, methodLists);

            if (methods != null)
            {
                //method = findBestMatch(key.t2,methods.methods);
                method = findBestMatch(t2, methods.methods);
                if (method != null)
                {
                    //cacheMethod(key,method);
                    cacheMethod(t1, t2, method);
                    return(method);
                }
            }
            return(null);
        }
        public void AddMethod(Object dispatch1,Object dispatch2,Object func)
        {
            BinOpList methods = (BinOpList)methodLists[dispatch1];

            if(methods == null)
            methodLists[dispatch1] = methods = new BinOpList();

            methods.methods[dispatch2] = func;

            clearCache();
        }
        public void AddMethod(Object dispatch1, Object dispatch2, Object func)
        {
            BinOpList methods = (BinOpList)methodLists[dispatch1];

            if (methods == null)
            {
                methodLists[dispatch1] = methods = new BinOpList();
            }

            methods.methods[dispatch2] = func;

            clearCache();
        }