// // propertyHandle - the "tkPropertyDef" that identifies the property. // definingType - the "tkTypeDef" that defined the field (this is where you get the metadata reader that created propertyHandle.) // contextType - the type that supplies the type context (i.e. substitutions for generic parameters.) Though you // get your raw information from "definingType", you report "contextType" as your DeclaringType property. // // For example: // // typeof(Foo<>).GetTypeInfo().DeclaredMembers // // The definingType and contextType are both Foo<> // // typeof(Foo<int,String>).GetTypeInfo().DeclaredMembers // // The definingType is "Foo<,>" // The contextType is "Foo<int,String>" // // We don't report any DeclaredMembers for arrays or generic parameters so those don't apply. // private RuntimePropertyInfo(PropertyHandle propertyHandle, RuntimeNamedTypeInfo definingTypeInfo, RuntimeTypeInfo contextTypeInfo) { _propertyHandle = propertyHandle; _definingTypeInfo = definingTypeInfo; _contextTypeInfo = contextTypeInfo; _reader = definingTypeInfo.Reader; _property = propertyHandle.GetProperty(_reader); }
// // propertyHandle - the "tkPropertyDef" that identifies the property. // definingType - the "tkTypeDef" that defined the field (this is where you get the metadata reader that created propertyHandle.) // contextType - the type that supplies the type context (i.e. substitutions for generic parameters.) Though you // get your raw information from "definingType", you report "contextType" as your DeclaringType property. // // For example: // // typeof(Foo<>).GetTypeInfo().DeclaredMembers // // The definingType and contextType are both Foo<> // // typeof(Foo<int,String>).GetTypeInfo().DeclaredMembers // // The definingType is "Foo<,>" // The contextType is "Foo<int,String>" // // We don't report any DeclaredMembers for arrays or generic parameters so those don't apply. // private NativeFormatRuntimePropertyInfo(PropertyHandle propertyHandle, NativeFormatRuntimeNamedTypeInfo definingTypeInfo, RuntimeTypeInfo contextTypeInfo, RuntimeTypeInfo reflectedType) : base(contextTypeInfo, reflectedType) { _propertyHandle = propertyHandle; _definingTypeInfo = definingTypeInfo; _reader = definingTypeInfo.Reader; _property = propertyHandle.GetProperty(_reader); }
} // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandle[] values) { uint count; offset = reader.DecodeUnsigned(offset, out count); if (count == 0) { values = s_emptyPropertyHandleArray; } else { values = new PropertyHandle[count]; for (uint i = 0; i < count; ++i) { PropertyHandle tmp; offset = reader.Read(offset, out tmp); values[i] = tmp; } } return offset; } // Read
} // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandle handle) { uint value; offset = reader.DecodeUnsigned(offset, out value); handle = new PropertyHandle((int)value); handle._Validate(); return offset; } // Read
public abstract IEnumerable<CustomAttributeData> GetPsuedoCustomAttributes(MetadataReader reader, PropertyHandle propertyHandle, TypeDefinitionHandle declaringTypeHandle);
public abstract bool GetDefaultValueIfAny(MetadataReader reader, PropertyHandle propertyHandle, Type declaredType, IEnumerable<CustomAttributeData> customAttributes, out Object defaultValue);
} // IsNull internal bool IsNull(PropertyHandle handle) { return (handle._value & 0x00FFFFFF) == 0; } // IsNull
} // ToHandle internal Handle ToHandle(PropertyHandle handle) { return new Handle(handle._value); } // ToHandle
} // GetPointerSignature public Property GetProperty(PropertyHandle handle) { var record = new Property() { _reader = this, _handle = handle }; var offset = (uint)handle.Offset; offset = _streamReader.Read(offset, out record._flags); offset = _streamReader.Read(offset, out record._name); offset = _streamReader.Read(offset, out record._signature); offset = _streamReader.Read(offset, out record._methodSemantics); offset = _streamReader.Read(offset, out record._defaultValue); offset = _streamReader.Read(offset, out record._customAttributes); return record; } // GetProperty
} // Equals public bool Equals(PropertyHandle handle) { return _value == handle._value; } // Equals
} // Read public static uint Read(this NativeReader reader, uint offset, out PropertyHandle[] values) { uint count; offset = reader.DecodeUnsigned(offset, out count); #if !NETFX_45 if (count == 0) { values = Array.Empty<PropertyHandle>(); } else #endif { values = new PropertyHandle[count]; for (uint i = 0; i < count; ++i) { PropertyHandle tmp; offset = reader.Read(offset, out tmp); values[i] = tmp; } } return offset; } // Read