| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | namespace System.Reflection.Metadata |
| | | 5 | | { |
| | | 6 | | public readonly struct MethodImplementation |
| | | 7 | | { |
| | | 8 | | private readonly MetadataReader _reader; |
| | | 9 | | |
| | | 10 | | // Workaround: JIT doesn't generate good code for nested structures, so use RowId. |
| | | 11 | | private readonly int _rowId; |
| | | 12 | | |
| | | 13 | | internal MethodImplementation(MetadataReader reader, MethodImplementationHandle handle) |
| | 0 | 14 | | { |
| | 0 | 15 | | _reader = reader; |
| | 0 | 16 | | _rowId = handle.RowId; |
| | 0 | 17 | | } |
| | | 18 | | |
| | | 19 | | private MethodImplementationHandle Handle |
| | | 20 | | { |
| | 0 | 21 | | get { return MethodImplementationHandle.FromRowId(_rowId); } |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public TypeDefinitionHandle Type |
| | | 25 | | { |
| | | 26 | | get |
| | 0 | 27 | | { |
| | 0 | 28 | | return _reader.MethodImplTable.GetClass(Handle); |
| | 0 | 29 | | } |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | public EntityHandle MethodBody |
| | | 33 | | { |
| | | 34 | | get |
| | 0 | 35 | | { |
| | 0 | 36 | | return _reader.MethodImplTable.GetMethodBody(Handle); |
| | 0 | 37 | | } |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | public EntityHandle MethodDeclaration |
| | | 41 | | { |
| | | 42 | | get |
| | 0 | 43 | | { |
| | 0 | 44 | | return _reader.MethodImplTable.GetMethodDeclaration(Handle); |
| | 0 | 45 | | } |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | public CustomAttributeHandleCollection GetCustomAttributes() |
| | 0 | 49 | | { |
| | 0 | 50 | | return new CustomAttributeHandleCollection(_reader, Handle); |
| | 0 | 51 | | } |
| | | 52 | | } |
| | | 53 | | } |
| | | 54 | | |