コード例 #1
0
ファイル: ProxyHelper.cs プロジェクト: pvginkel/Jint2
        public static JsObject BuildDelegateFunction(JsGlobal global, Delegate @delegate)
        {
            if (global == null)
                throw new ArgumentNullException("global");
            if (@delegate == null)
                throw new ArgumentNullException("delegate");

            return global.CreateFunction(
                @delegate.Method.Name,
                WrapDelegate(@delegate),
                @delegate.Method.GetParameters().Length
            );
        }
コード例 #2
0
ファイル: ProxyHelper.cs プロジェクト: pvginkel/Jint2
        public static JsObject BuildMethodFunction(JsGlobal global, MethodInfo method)
        {
            if (method == null)
                throw new ArgumentNullException("method");
            if (global == null)
                throw new ArgumentNullException("global");
            if (method.ContainsGenericParameters)
                throw new InvalidOperationException("Can't wrap an unclosed generic");

            return global.CreateFunction(
                method.Name,
                WrapMethod(method),
                method.GetParameters().Length
            );
        }