ICorProfilerInfo2::GetClassFromTokenAndTypeArgs Method
Gets the ClassID
of a type by using the specified metadata token and the ClassID
values of any type arguments.
Syntax
HRESULT GetClassFromTokenAndTypeArgs(
[in] ModuleID moduleID,
[in] mdTypeDef typeDef,
[in] ULONG32 cTypeArgs,
[in, size_is(cTypeArgs)] ClassID typeArgs[],
[out] ClassID* pClassID);
Parameters
moduleID
[in] The ID of the module in which the type resides.
typeDef
[in] An mdTypeDef
metadata token that references the type.
cTypeArgs
[in] The number of type parameters for the given type. This value must be zero for non-generic types.
typeArgs
[in] An array of ClassID
values, each of which is an argument of the type. The value of typeArgs
can be NULL if cTypeArgs
is set to zero.
pClassID
[out] A pointer to the ClassID
of the specified type.
Remarks
Calling the GetClassFromTokenAndTypeArgs
method with an mdTypeRef
instead of an mdTypeDef
metadata token can have unpredictable results; callers should resolve the mdTypeRef
to an mdTypeDef
when passing it.
If the type is not already loaded, calling GetClassFromTokenAndTypeArgs
will trigger loading, which is a dangerous operation in many contexts. For example, calling this method during loading of modules or other types could lead to an infinite loop as the runtime attempts to circularly load things.
In general, use of GetClassFromTokenAndTypeArgs
is discouraged. If profilers are interested in events for a particular type, they should store the ModuleID
and mdTypeDef
of that type, and use ICorProfilerInfo2::GetClassIDInfo2 to check whether a given ClassID
is that of the desired type.
Requirements
Platforms: See System Requirements.
Header: CorProf.idl, CorProf.h
Library: CorGuids.lib
.NET Framework Versions: Available since 2.0