Example #1
0
        private void DispatchEvent(object sender,
                                   object o01 = null, object o02 = null, object o03 = null, object o04 = null,
                                   object o05 = null, object o06 = null, object o07 = null, object o08 = null,
                                   object o09 = null, object o10 = null, object o11 = null, object o12 = null,
                                   object o13 = null, object o14 = null, object o15 = null, object o16 = null)
        {
            Closure[] closures = null;
            lock (m_Lock)
            {
                closures = m_Callbacks.Find(sender).ToArray();
            }

            foreach (Closure c in closures)
            {
                c.Call(o01, o02, o03, o04, o05, o06, o07, o08, o09, o10, o11, o12, o13, o14, o15, o16);
            }
        }
Example #2
0
        /// <summary>
        /// Gets all the extension methods which can match a given name and extending a given Type
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="extendedType">The extended type.</param>
        /// <returns></returns>
        public static List <IOverloadableMemberDescriptor> GetExtensionMethodsByNameAndType(string name, Type extendedType)
        {
            List <UnresolvedGenericMethod> unresolvedGenerics = null;

            lock (s_Lock)
            {
                unresolvedGenerics = s_UnresolvedGenericsRegistry.Find(name).ToList();
            }

            foreach (UnresolvedGenericMethod ugm in unresolvedGenerics)
            {
                ParameterInfo[] args = ugm.Method.GetParameters();
                if (args.Length == 0)
                {
                    continue;
                }
                Type extensionType = args[0].ParameterType;

                Type genericType = GetGenericMatch(extensionType, extendedType);

                if (ugm.AlreadyAddedTypes.Add(genericType))
                {
                    if (genericType != null)
                    {
                        MethodInfo mi = InstantiateMethodInfo(ugm.Method, extensionType, genericType, extendedType);
                        if (mi != null)
                        {
                            if (!MethodMemberDescriptor.CheckMethodIsCompatible(mi, false))
                            {
                                continue;
                            }

                            var desc = new MethodMemberDescriptor(mi, ugm.AccessMode);

                            s_Registry.Add(ugm.Method.Name, desc);
                            ++s_ExtensionMethodChangeVersion;
                        }
                    }
                }
            }

            return(s_Registry.Find(name)
                   .Where(d => d.ExtensionMethodType != null && d.ExtensionMethodType.IsAssignableFrom(extendedType))
                   .ToList());
        }
Example #3
0
 /// <summary>
 /// Gets all the extension methods which can match a given name
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static IEnumerable <IOverloadableMemberDescriptor> GetExtensionMethodsByName(string name)
 {
     lock (s_Lock)
         return(new List <IOverloadableMemberDescriptor>(s_Registry.Find(name)));
 }
Example #4
0
 /// <summary>
 /// Gets all the extension methods which can match a given name
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static IEnumerable <StandardUserDataMethodDescriptor> GetExtensionMethodsByName(string name)
 {
     lock (s_Lock)
         return(s_ExtensionMethodRegistry.Find(name));
 }