コード例 #1
0
        public DataTypePointer[] GetConcreteTypes()
        {
            IGenericTypePointer gtp = _methodPointer as IGenericTypePointer;

            if (gtp != null)
            {
                return(gtp.GetConcreteTypes());
            }
            return(null);
        }
コード例 #2
0
        /// <summary>
        /// returns corresponding concrete types for generic arguments
        /// 1. method parameters
        /// 2. method return type
        /// 3. owner type arguments
        /// different sections may overlap, duplications may exist
        /// </summary>
        /// <returns></returns>
        public DataTypePointer[] GetConcreteTypes()
        {
            List <DataTypePointer> l = new List <DataTypePointer>();

            if (_paramTypes != null && _paramTypes.Length > 0)
            {
                for (int i = 0; i < _paramTypes.Length; i++)
                {
                    if (_paramTypes[i].IsGenericParameter || _paramTypes[i].IsGenericType)
                    {
                        DataTypePointer dp = GetConcreteType(_paramTypes[i]);
                        if (dp != null)
                        {
                            l.Add(dp);
                        }
                    }
                }
            }
            if (_concreteReturnType != null)
            {
                l.Add(_concreteReturnType);
            }
            IGenericTypePointer igp = this.Owner as IGenericTypePointer;

            if (igp != null)
            {
                DataTypePointer[] dps = igp.GetConcreteTypes();
                if (dps != null && dps.Length > 0)
                {
                    DataTypePointer[] ps = new DataTypePointer[l.Count + dps.Length];
                    l.CopyTo(ps, 0);
                    dps.CopyTo(ps, l.Count);
                    return(ps);
                }
            }
            return(l.ToArray());
        }