Class ParameterizedType
- Namespace
- ICSharpCode.Decompiler.TypeSystem
- Assembly
- ICSharpCode.Decompiler.dll
ParameterizedType represents an instance of a generic type. Example: List<string>
public sealed class ParameterizedType : IType, INamedElement, IEquatable<IType>
- Inheritance
-
ParameterizedType
- Implements
- Inherited Members
- Extension Methods
Remarks
When getting the members, this type modifies the lists so that type parameters in the signatures of the members are replaced with the type arguments.
Constructors
ParameterizedType(IType, IEnumerable<IType>)
public ParameterizedType(IType genericType, IEnumerable<IType> typeArguments)
Parameters
genericType
ITypetypeArguments
IEnumerable<IType>
Properties
DeclaringType
Gets the parent type, if this is a nested type. Returns null for top-level types.
public IType DeclaringType { get; }
Property Value
DirectBaseTypes
public IEnumerable<IType> DirectBaseTypes { get; }
Property Value
FullName
public string FullName { get; }
Property Value
GenericType
public IType GenericType { get; }
Property Value
IsByRefLike
Gets whether this type is "ref-like": a ByReferenceType or "ref struct".
public bool IsByRefLike { get; }
Property Value
IsReferenceType
public bool? IsReferenceType { get; }
Property Value
- bool?
Kind
Gets the type kind.
public TypeKind Kind { get; }
Property Value
Name
public string Name { get; }
Property Value
Namespace
Gets the full name of the namespace containing this entity.
public string Namespace { get; }
Property Value
Nullability
Gets the nullability annotation on this type.
public Nullability Nullability { get; }
Property Value
ReflectionName
public string ReflectionName { get; }
Property Value
TypeArguments
Gets the type arguments passed to this type.
If this type is a generic type definition that is not parameterized, this property returns the type parameters,
as if the type was parameterized with its own type arguments (class C<T> { C<T> field; }
).
public IReadOnlyList<IType> TypeArguments { get; }
Property Value
TypeParameterCount
Gets the number of type parameters.
public int TypeParameterCount { get; }
Property Value
TypeParameters
Gets the type parameters. Returns an empty list if this type is not generic.
public IReadOnlyList<ITypeParameter> TypeParameters { get; }
Property Value
Methods
AcceptVisitor(TypeVisitor)
public IType AcceptVisitor(TypeVisitor visitor)
Parameters
visitor
TypeVisitor
Returns
ChangeNullability(Nullability)
Creates a new type that is a copy of this type, with the changed nullability annotation.
public IType ChangeNullability(Nullability nullability)
Parameters
nullability
Nullability
Returns
Equals(IType)
public bool Equals(IType other)
Parameters
other
IType
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetAccessors(Predicate<IMethod>, GetMemberOptions)
public IEnumerable<IMethod> GetAccessors(Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<IMethod>options
GetMemberOptions
Returns
GetConstructors(Predicate<IMethod>, GetMemberOptions)
public IEnumerable<IMethod> GetConstructors(Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers)
Parameters
filter
Predicate<IMethod>options
GetMemberOptions
Returns
GetDefinition()
Gets the definition of the generic type.
For ParameterizedType
, this method never returns null.
public ITypeDefinition GetDefinition()
Returns
GetDefinitionOrUnknown()
Gets the underlying type definition or UnkownType, if unknown. Can return null for types which do not have a type definition (for example arrays, pointers, type parameters).
public ITypeDefinitionOrUnknown GetDefinitionOrUnknown()
Returns
GetEvents(Predicate<IEvent>, GetMemberOptions)
public IEnumerable<IEvent> GetEvents(Predicate<IEvent> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<IEvent>options
GetMemberOptions
Returns
GetFields(Predicate<IField>, GetMemberOptions)
public IEnumerable<IField> GetFields(Predicate<IField> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<IField>options
GetMemberOptions
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetMembers(Predicate<IMember>, GetMemberOptions)
public IEnumerable<IMember> GetMembers(Predicate<IMember> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<IMember>options
GetMemberOptions
Returns
GetMethods(IReadOnlyList<IType>, Predicate<IMethod>, GetMemberOptions)
public IEnumerable<IMethod> GetMethods(IReadOnlyList<IType> typeArguments, Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
typeArguments
IReadOnlyList<IType>filter
Predicate<IMethod>options
GetMemberOptions
Returns
GetMethods(Predicate<IMethod>, GetMemberOptions)
public IEnumerable<IMethod> GetMethods(Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<IMethod>options
GetMemberOptions
Returns
GetNestedTypes(IReadOnlyList<IType>, Predicate<ITypeDefinition>, GetMemberOptions)
public IEnumerable<IType> GetNestedTypes(IReadOnlyList<IType> typeArguments, Predicate<ITypeDefinition> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
typeArguments
IReadOnlyList<IType>filter
Predicate<ITypeDefinition>options
GetMemberOptions
Returns
GetNestedTypes(Predicate<ITypeDefinition>, GetMemberOptions)
public IEnumerable<IType> GetNestedTypes(Predicate<ITypeDefinition> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<ITypeDefinition>options
GetMemberOptions
Returns
GetProperties(Predicate<IProperty>, GetMemberOptions)
public IEnumerable<IProperty> GetProperties(Predicate<IProperty> filter = null, GetMemberOptions options = GetMemberOptions.None)
Parameters
filter
Predicate<IProperty>options
GetMemberOptions
Returns
GetSubstitution()
Gets a type visitor that performs the substitution of class type parameters with the type arguments of this parameterized type.
public TypeParameterSubstitution GetSubstitution()
Returns
GetSubstitution(IReadOnlyList<IType>)
Gets a type visitor that performs the substitution of class type parameters with the type arguments of this parameterized type, and also substitutes method type parameters with the specified method type arguments.
public TypeParameterSubstitution GetSubstitution(IReadOnlyList<IType> methodTypeArguments)
Parameters
methodTypeArguments
IReadOnlyList<IType>
Returns
GetTypeArgument(int)
Same as 'parameterizedType.TypeArguments[index]'.
public IType GetTypeArgument(int index)
Parameters
index
int
Returns
ToString()
public override string ToString()
Returns
VisitChildren(TypeVisitor)
public IType VisitChildren(TypeVisitor visitor)
Parameters
visitor
TypeVisitor