Class TypeRef
- Namespace
- Microsoft.VisualStudio.Composition.Reflection
- Assembly
- Microsoft.VisualStudio.Composition.dll
public class TypeRef : IEquatable<TypeRef>, IEquatable<Type>
- Inheritance
-
TypeRef
- Implements
- Inherited Members
- Extension Methods
Properties
AssemblyId
public StrongAssemblyIdentity AssemblyId { get; }
Property Value
AssemblyName
public AssemblyName AssemblyName { get; }
Property Value
BaseTypes
Gets the full list of base types and interfaces for this instance.
public ImmutableArray<TypeRef> BaseTypes { get; }
Property Value
Remarks
This list will only be populated if this instance was created with shallow set to false. The collection is ordered bottom-up for types with the implemented interfaces appended at the end.
ElementTypeRef
public TypeRef ElementTypeRef { get; }
Property Value
FullName
Gets the full name of the type represented by this instance. When representing a generic type, this is the full name of the generic type definition.
public string FullName { get; }
Property Value
GenericTypeArguments
public ImmutableArray<TypeRef> GenericTypeArguments { get; }
Property Value
GenericTypeParameterCount
public int GenericTypeParameterCount { get; }
Property Value
IsArray
public bool IsArray { get; }
Property Value
IsGenericType
public bool IsGenericType { get; }
Property Value
IsGenericTypeDefinition
public bool IsGenericTypeDefinition { get; }
Property Value
IsShallow
Gets a value indicating whether or not this TypeRef is shallow. Shallow TypeRefs do not have a defined list of base types.
public bool IsShallow { get; }
Property Value
IsValueType
public bool IsValueType { get; }
Property Value
MetadataToken
public int MetadataToken { get; }
Property Value
TypeFlags
public TypeRefFlags TypeFlags { get; }
Property Value
Methods
Equals(TypeRef?)
public bool Equals(TypeRef? other)
Parameters
other
TypeRef
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
Equals(Type?)
public bool Equals(Type? other)
Parameters
other
Type
Returns
Get(Resolver, StrongAssemblyIdentity, int, string, TypeRefFlags, int, ImmutableArray<TypeRef>, bool, ImmutableArray<TypeRef>, TypeRef?)
public static TypeRef Get(Resolver resolver, StrongAssemblyIdentity assemblyId, int metadataToken, string fullName, TypeRefFlags typeFlags, int genericTypeParameterCount, ImmutableArray<TypeRef> genericTypeArguments, bool shallow, ImmutableArray<TypeRef> baseTypes, TypeRef? elementTypeRef)
Parameters
resolver
ResolverassemblyId
StrongAssemblyIdentitymetadataToken
intfullName
stringtypeFlags
TypeRefFlagsgenericTypeParameterCount
intgenericTypeArguments
ImmutableArray<TypeRef>shallow
boolbaseTypes
ImmutableArray<TypeRef>elementTypeRef
TypeRef
Returns
Get(Resolver, AssemblyName, int, string, TypeRefFlags, int, ImmutableArray<TypeRef>, bool, ImmutableArray<TypeRef>, TypeRef?)
public static TypeRef Get(Resolver resolver, AssemblyName assemblyName, int metadataToken, string fullName, TypeRefFlags typeFlags, int genericTypeParameterCount, ImmutableArray<TypeRef> genericTypeArguments, bool shallow, ImmutableArray<TypeRef> baseTypes, TypeRef? elementTypeRef)
Parameters
resolver
ResolverassemblyName
AssemblyNamemetadataToken
intfullName
stringtypeFlags
TypeRefFlagsgenericTypeParameterCount
intgenericTypeArguments
ImmutableArray<TypeRef>shallow
boolbaseTypes
ImmutableArray<TypeRef>elementTypeRef
TypeRef
Returns
Get(Type?, Resolver)
Gets a TypeRef that represents a given Type instance.
public static TypeRef? Get(Type? type, Resolver resolver)
Parameters
Returns
GetHashCode()
public override int GetHashCode()
Returns
IsAssignableFrom(TypeRef)
Checks if the type represented by the given TypeRef can be assigned to the type represented by this instance.
public bool IsAssignableFrom(TypeRef other)
Parameters
other
TypeRefTypeRef to compare to.
Returns
- bool
true if the given TypeRef can be assigned to this instance, false otherwise.
Remarks
The assignability check is done by traversing all the base types and interfaces of the given TypeRef to check if any of them are equal to this instance. Should that fail, the CLR is asked to check for assignability which will trigger an assembly load.
MakeGenericTypeRef(ImmutableArray<TypeRef>)
public TypeRef MakeGenericTypeRef(ImmutableArray<TypeRef> genericTypeArguments)
Parameters
genericTypeArguments
ImmutableArray<TypeRef>