public IList <DataTypePointer> GetGenericTypes() { IGenericTypePointer gtp = _methodPointer as IGenericTypePointer; if (gtp != null) { return(gtp.GetGenericTypes()); } return(null); }
/// <summary> /// each generic type is defined by a DataTypePointer with its BaseClassType being the generic parameter and its _concretTypeForTypeParameter being the concrete type /// </summary> /// <returns></returns> public IList <DataTypePointer> GetGenericTypes() { List <DataTypePointer> l = new List <DataTypePointer>(); if (_paramTypes != null && _paramTypes.Length > 0) { for (int i = 0; i < _paramTypes.Length; i++) { if (_paramTypes[i] != null && (_paramTypes[i].IsGenericParameter || _paramTypes[i].IsGenericType)) { DataTypePointer dp = new DataTypePointer(_paramTypes[i]); DataTypePointer cp = GetConcreteType(_paramTypes[i]); if (cp != null) { dp.SetConcreteType(cp); l.Add(dp); } } } } if (_returnType != null && _concreteReturnType != null) { bool found = false; foreach (DataTypePointer p in l) { if (_returnType.Equals(p.BaseClassType)) { found = true; break; } } if (!found) { DataTypePointer dp = new DataTypePointer(_returnType); dp.SetConcreteType(_concreteReturnType); l.Add(dp); } } if (TypeParameters != null && TypeParameters.Length > 0) { if (_genericParams != null && _genericParams.Length == TypeParameters.Length) { for (int i = 0; i < _genericParams.Length; i++) { bool found = false; foreach (DataTypePointer p in l) { if (_genericParams[i].Equals(p.BaseClassType)) { found = true; break; } } if (!found) { DataTypePointer dp = new DataTypePointer(_genericParams[i]); dp.SetConcreteType(TypeParameters[i]); l.Add(dp); } } } } IGenericTypePointer igp = this.Owner as IGenericTypePointer; if (igp != null) { IList <DataTypePointer> ls = igp.GetGenericTypes(); if (ls != null && ls.Count > 0) { foreach (DataTypePointer p0 in ls) { bool found = false; foreach (DataTypePointer p in l) { if (p0.Equals(p.BaseClassType)) { found = true; break; } } if (!found) { l.Add(p0); } } } } return(l); }