Esempio n. 1
0
        private static BuiltinMethodCallback CreateMultiMethod(TypeRegistry registry,
                                                               Type type,
                                                               string name)
        {
            var methods = type.GetMembers(BindingFlags.Public | BindingFlags.Static)
                          .Where(p => p.Name == name && p.MemberType == MemberTypes.Method)
                          .Select(p => (MethodInfo)p);

            return(MethodWrapper.Create(registry, methods, null));
        }
Esempio n. 2
0
        private static BuiltinMethodCallback CreateMultiMethod(TypeRegistry registry,
                                                               Type type,
                                                               object self,
                                                               string name)
        {
            var methods = type.GetMembers(BindingFlags.Public | BindingFlags.Instance)
                          .Where(p => p.Name == name && p.MemberType == MemberTypes.Method)
                          .Select(p => (MethodInfo)p);

            if (methods.Count() > 1)
            {
                return(MethodWrapper.Create(registry, methods, self));
            }
            else
            {
                return(MethodWrapper.Create(registry, methods.First(), self));
            }
        }