예제 #1
0
        /// <summary>
        /// Instanciate a standard MessageProxy
        /// </summary>
        /// <param name="messageName"></param>
        /// <param name="args"></param>
        public MessageProxy(string messageName, Type TArgsType, object[] args)
        {
            //Not needed as boolean is false by default
            //But just for reading clarity
            IsJSInvokable = false;

            InteropMethod     = messageName;
            InteropParameters = args;
            InteropArgsType   = new TypeProxy(TArgsType);
        }
예제 #2
0
        public static TypeProxy[] GetGenericTypesFromRuntimeMethod(MethodInfo method)
        {
            if (!method.IsGenericMethod)
            {
                return(new TypeProxy[0]);
            }

            if (method.IsGenericMethodDefinition)
            {
                throw new ArgumentException("In order to retrieve Generic Types from MethodInfo, the method should be the implemented one and not the generic definition");
            }

            var types = method.GetGenericArguments();
            List <TypeProxy> typeProxies = new List <TypeProxy>();

            foreach (var type in types)
            {
                TypeProxy typeProxy = new TypeProxy(type);
                typeProxies.Add(typeProxy);
            }

            return(typeProxies.ToArray());
        }