Table of Contents

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 IType
typeArguments 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

IType

DirectBaseTypes

public IEnumerable<IType> DirectBaseTypes { get; }

Property Value

IEnumerable<IType>

FullName

public string FullName { get; }

Property Value

string

GenericType

public IType GenericType { get; }

Property Value

IType

IsByRefLike

Gets whether this type is "ref-like": a ByReferenceType or "ref struct".

public bool IsByRefLike { get; }

Property Value

bool

IsReferenceType

public bool? IsReferenceType { get; }

Property Value

bool?

Kind

Gets the type kind.

public TypeKind Kind { get; }

Property Value

TypeKind

Name

public string Name { get; }

Property Value

string

Namespace

Gets the full name of the namespace containing this entity.

public string Namespace { get; }

Property Value

string

Nullability

Gets the nullability annotation on this type.

public Nullability Nullability { get; }

Property Value

Nullability

ReflectionName

public string ReflectionName { get; }

Property Value

string

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

IReadOnlyList<IType>

TypeParameterCount

Gets the number of type parameters.

public int TypeParameterCount { get; }

Property Value

int

TypeParameters

Gets the type parameters. Returns an empty list if this type is not generic.

public IReadOnlyList<ITypeParameter> TypeParameters { get; }

Property Value

IReadOnlyList<ITypeParameter>

Methods

AcceptVisitor(TypeVisitor)

public IType AcceptVisitor(TypeVisitor visitor)

Parameters

visitor TypeVisitor

Returns

IType

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

IType

Equals(IType)

public bool Equals(IType other)

Parameters

other IType

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetAccessors(Predicate<IMethod>, GetMemberOptions)

public IEnumerable<IMethod> GetAccessors(Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<IMethod>
options GetMemberOptions

Returns

IEnumerable<IMethod>

GetConstructors(Predicate<IMethod>, GetMemberOptions)

public IEnumerable<IMethod> GetConstructors(Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers)

Parameters

filter Predicate<IMethod>
options GetMemberOptions

Returns

IEnumerable<IMethod>

GetDefinition()

Gets the definition of the generic type. For ParameterizedType, this method never returns null.

public ITypeDefinition GetDefinition()

Returns

ITypeDefinition

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

ITypeDefinitionOrUnknown

GetEvents(Predicate<IEvent>, GetMemberOptions)

public IEnumerable<IEvent> GetEvents(Predicate<IEvent> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<IEvent>
options GetMemberOptions

Returns

IEnumerable<IEvent>

GetFields(Predicate<IField>, GetMemberOptions)

public IEnumerable<IField> GetFields(Predicate<IField> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<IField>
options GetMemberOptions

Returns

IEnumerable<IField>

GetHashCode()

public override int GetHashCode()

Returns

int

GetMembers(Predicate<IMember>, GetMemberOptions)

public IEnumerable<IMember> GetMembers(Predicate<IMember> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<IMember>
options GetMemberOptions

Returns

IEnumerable<IMember>

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

IEnumerable<IMethod>

GetMethods(Predicate<IMethod>, GetMemberOptions)

public IEnumerable<IMethod> GetMethods(Predicate<IMethod> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<IMethod>
options GetMemberOptions

Returns

IEnumerable<IMethod>

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

IEnumerable<IType>

GetNestedTypes(Predicate<ITypeDefinition>, GetMemberOptions)

public IEnumerable<IType> GetNestedTypes(Predicate<ITypeDefinition> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<ITypeDefinition>
options GetMemberOptions

Returns

IEnumerable<IType>

GetProperties(Predicate<IProperty>, GetMemberOptions)

public IEnumerable<IProperty> GetProperties(Predicate<IProperty> filter = null, GetMemberOptions options = GetMemberOptions.None)

Parameters

filter Predicate<IProperty>
options GetMemberOptions

Returns

IEnumerable<IProperty>

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

TypeParameterSubstitution

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

TypeParameterSubstitution

GetTypeArgument(int)

Same as 'parameterizedType.TypeArguments[index]'.

public IType GetTypeArgument(int index)

Parameters

index int

Returns

IType

ToString()

public override string ToString()

Returns

string

VisitChildren(TypeVisitor)

public IType VisitChildren(TypeVisitor visitor)

Parameters

visitor TypeVisitor

Returns

IType