public ICallableCore BindTypes(Types genericTypes)
        {
            //{
            //    ICallableCore core;
            //    if (_BindedGenericCache.TryGetValue(genericTypes, out core))
            //    {
            //        return core;
            //    }
            //}

            int cnt = genericTypes.Count;
            LinkedListNode <GenericCallableCore> node;

            _GenericParamCountCache.TryGetValue(cnt, out node);
            if (node == null)
            {
                //_BindedGenericCache[genericTypes] = null;
                return(null);
            }
            List <UniqueCallableCore> methods = new List <UniqueCallableCore>();

            do
            {
                UniqueCallableCore core = node.Value.BindTypes(genericTypes) as UniqueCallableCore;
                if (core != null)
                {
                    methods.Add(core);
                }
                node = node.Next;
            } while (node != null && node.Value._GenericParams.Count == cnt);
            if (methods.Count <= 0)
            {
                //_BindedGenericCache[genericTypes] = null;
                return(null);
            }
            else if (methods.Count == 1)
            {
                var core = methods[0];
                //_BindedGenericCache[genericTypes] = core;
                return(core);
            }
            else
            {
                var core = new GroupCallableCore(null);
                for (int i = 0; i < methods.Count; ++i)
                {
                    core._SeqCache.AddLast(methods[i]);
                }
                //_BindedGenericCache[genericTypes] = core;
                return(core);
            }
        }
Ejemplo n.º 2
0
 internal GroupCallableOverloadSelector(GroupCallableCore core, object tar)
 {
     _Core  = core;
     Target = tar;
 }