Closed
Description
Background and motivation
S.R.Metadata provides a way to get the owning type of fields and methods. It doesn't provide an API to get owning type of properties and events. I think it should be exposed for parity.
The lookup strategy is similar (a binary search in one of the tables).
API Proposal
namespace System.Reflection.Metadata
{
public struct PropertyDefinition
{
public TypeDefinitionHandle GetDeclaringType();
}
public struct EventDefinition
{
public TypeDefinitionHandle GetDeclaringType();
}
}
API Usage
PropertyDefinition someProperty = ...;
var owningType = someProperty.GetDeclaringType();
Risks
No response