Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Host objects that implement IExpando (IDispatchEx)

0
0
I ended up modifying ClearScript source to solve this problem.

I modified HostItem
private bool BindSpecialTarget<T>(out T specialTarget) where T : class
and included the following code at the beginning of the method:
            if (typeof(T) == typeof(IDynamic))
            {
                if (target.Type.IsCOMObject)
                {
                    T dyn = this.engine.MarshalToHost(target.Target, false) as T;
                    if (dyn != null)
                    {
                        specialTarget = dyn;
                        return true;
                    }
                }
            }

Viewing all articles
Browse latest Browse all 2297