Microsoft.Scripting.Metadata Represents a block in memory. Reads data from a memory block. Maintains a position. Reads zero terminated sequence of bytes of given maximal length and converts it into an ASCII string. Zero terminated, UTF8 encoded sequence of bytes representing a name in metadata (a type name, a member name, etc). The name is bound to the module it was retrieved from. The module is kept alive until all its metadata names are collected. Doesn't cache hashcode, byte or character count. Gets the module whose metadata tables this instance represents. Null if the tables reflect unloaded module file. Gets the path of the module whose metadata tables this instance represents. Null for in-memory modules that are not backed by a file. The path is not accessible in partial trust. Returns AssemblyDef for manifest modules, null token otherwise. Token is null or represents a row in a metadata table. Gets the number of records in the view. If the view is over an entire table this operation is O(1), otherwise it might take up to O(log(#records in the table)). Module table entry (0x00 tokens). TypeRef table entry (0x01 tokens). AssemblyRef: If the target type is defined in a different Assembly from the current module. TypeRef: Target type is nested in TypeRef. ModuleRef: Target type is defined in another module within the same Assembly as this one. ModuleDef: If the target type is defined in the current module (this should not occur in a CLI "compressed metadata" module). Null token: There shall be a row in the ExportedType table for this Type - its Implementation field shall contain a File token or an AssemblyRef token that says where the type is defined. TypeDef table entry (0x02 tokens). Flags field in TypeDef table. Finds a nesting type-def. The search time is logarithmic in the number of nested types defined in the owning module. Returns a null token if this is not a nested type-def. O(log(#generic parameters in module)) This typedef represents a container of global functions and fields (manufactured <Module> type). Combines Field (0x04 tokens), FieldRVA (0x1d tokens) and Constant (0x0B) table entries. Flags field in the Field table. O(log(#fields, parameters and properties with default value)). Returns if the field doesn't have a default value. Returns null reference iff the field has no RVA. If size is 0 the memory block will span over the rest of the data section. O(log(#fields with RVAs)). Finds type-def that declares this field. The search time is logarithmic in the number of types defined in the owning module. MethodDef table entry (0x06 tokens). ImplFlags field in the MethodDef table. Flags field in the MethodDef table. Returns a null reference iff the method has no body. If size is 0 the memory block will span over the rest of the data section. Finds type-def that declares this method. The search time is logarithmic in the number of types defined in the owning module. O(log(#generic parameters in module)) Param table entry (0x08 tokens). Value greater or equal to zero and less than or equal to the number of parameters in owner method. A value of 0 refers to the owner method's return type; its parameters are then numbered from 1 onwards. Not all parameters need to have a corresponding ParamDef entry. O(log(#fields, parameters and properties with default value)). Returns if the field doesn't have a default value. Binary searches MethodDef table for a method that declares this parameter. InterfaceImpl table entry (0x09 tokens). TODO: we might not need this - TypeDef.ImplementedInterfaces might be a special enumerator that directly returns InterfaceType tokens. Could be a null token in EnC scenarios. TypeDef, TypeRef, or TypeSpec. MemberRef table entry (0x0A tokens). Stores MethodRefs and FieldRefs. TypeRef or TypeDef: If the class that defines the member is defined in another module. Note that it is unusual, but valid, to use a TypeRef token when the member is defined in this same module, in which case, its TypeDef token can be used instead. ModuleRef: If the member is defined, in another module of the same assembly, as a global function or variable. MethodDef: When used to supply a call-site signature for a vararg method that is defined in this module. The Name shall match the Name in the corresponding MethodDef row. The Signature shall match the Signature in the target method definition TypeSpec: If the member is a member of a generic type CustomAttribute table entry (0x0C tokens). Any token except the CustomAttribute. Returns the value of Type column in the CustomAttribute table. MethodDef or MemberRef. Value blob. StandAloneSig table entry (0x11 token). Combines information from PropertyMap (0x15), MethodSemantics (0x18) and Property (0x17) tables. O(log(#fields, parameters and properties with default value)). Returns if the field doesn't have a default value. Finds type-def that declares this property. The search time is logarithmic in the number of types with properties defined in the owning module. Combines information from EventMap (0x15), MethodSemantics (0x18) and Event (0x17) tables. Finds type-def that declares this event. The search time is logarithmic in the number of types with events defined in the owning module. ModuleRef table entry (0x1A tokens). TypeSpec table entry (0x1B tokens). Assembly table entry (0x20 tokens). Assembly table entry (0x23 tokens). File table entry (0x26 tokens). ExportedType table entry (0x27 tokens). Forwarded type: AssemblyRef Nested types: ExportedType Type in another module of this assembly: FileDef ManifestResource table entry (0x28 tokens). NestedClass table entry (0x29 tokens). TODO: Don't need if we exposed nested types enumeration on type-def directly and build TypeNesting mapping lazily. GenericParam table entry (0x2A tokens). Value greater or equal to zero and less than or equal to the number of parameters in owner method/type. All generic parameters are listed in the table. TypeDef or MethodDef. GenericParamConstraint table entry (0x2C tokens). TypeDef, TypeRef, or TypeSpec. MethodSpec table entry (0x2B tokens). Used when decoding IL instructions. MethodDef or MethodRef. We need to be able to construct tokens out of byte-code.