diff --git a/ICSharpCode.NRefactory/TypeSystem/IType.cs b/ICSharpCode.NRefactory/TypeSystem/IType.cs index d611d0c065..e13ebb7113 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IType.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IType.cs @@ -82,6 +82,12 @@ namespace ICSharpCode.NRefactory.TypeSystem /// int TypeParameterCount { get; } + /// + /// If the type has type parameters it's the same as GetDefinition ().TypeParameters otherwise it returns an empty list. + /// NOTE: The type will change to IReadOnlyList in future versions. + /// + IList TypeParameters { get; } + /// /// Gets the type arguments passed to this type. /// If only the type parameters for the class were specified and the generic type diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedTypeParameter.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedTypeParameter.cs index 6afa854d0c..77662a5422 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedTypeParameter.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedTypeParameter.cs @@ -207,6 +207,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation get { return 0; } } + readonly static IList emptyTypeParameters = new ITypeParameter[0]; + IList IType.TypeParameters { + get { return emptyTypeParameters; } + } + readonly static IList emptyTypeArguments = new IType[0]; IList IType.TypeArguments { get { return emptyTypeArguments; } diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs index 3d68ee62d0..8e42020ea8 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractType.cs @@ -59,6 +59,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation get { return 0; } } + readonly static IList emptyTypeParameters = new ITypeParameter[0]; + public virtual IList TypeParameters { + get { return emptyTypeParameters; } + } + readonly static IList emptyTypeArguments = new IType[0]; IList IType.TypeArguments { get { return emptyTypeArguments; } diff --git a/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs b/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs index 658f715e0c..f53a68dcc5 100644 --- a/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs +++ b/ICSharpCode.NRefactory/TypeSystem/ParameterizedType.cs @@ -103,7 +103,11 @@ namespace ICSharpCode.NRefactory.TypeSystem public int TypeParameterCount { get { return typeArguments.Length; } } - + + public IList TypeParameters { + get { return genericType.TypeParameters; } + } + public string FullName { get { return genericType.FullName; } }