Estoy usando el
IMetaDataImport API and and I need to determine if the type definitions in my assembly are value or reference types. I have not found any method in the API that explicitely provides this information. However, I can easily enough obtain the base type and check if it is
My question is: is the base class the only way through which CLI metadata encodes the fact that a type is a value type or are there some flags for this somewhere?
preguntado el 01 de julio de 12 a las 00:07
There are no flags that identify value types directly. It looks like checking the base type, along with a couple of other things, is the canonical way to do it.
Section II.10.1.3 of the Especificaciones de ECMA CLI describes the type definition like this:
The type semantic attributes specify whether an interface, class, or value type shall be defined. The interfaz. attribute specifies an interface. If this attribute is not present and the definition extends (directly or indirectly)
System.ValueType, and the definition is not for
System.Enum, a value type shall be defined. Otherwise, a class shall be defined.