/
InterfaceImplementation.cs
44 lines (35 loc) · 1.35 KB
/
InterfaceImplementation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
namespace System.Reflection.Metadata
{
public readonly struct InterfaceImplementation
{
private readonly MetadataReader _reader;
// Workaround: JIT doesn't generate good code for nested structures, so use RowId.
private readonly int _rowId;
internal InterfaceImplementation(MetadataReader reader, InterfaceImplementationHandle handle)
{
Debug.Assert(reader != null);
Debug.Assert(!handle.IsNil);
_reader = reader;
_rowId = handle.RowId;
}
private InterfaceImplementationHandle Handle
{
get { return InterfaceImplementationHandle.FromRowId(_rowId); }
}
/// <summary>
/// The interface that is implemented
/// <see cref="TypeDefinitionHandle"/>, <see cref="TypeReferenceHandle"/>, or <see cref="TypeSpecificationHandle"/>
/// </summary>
public EntityHandle Interface
{
get { return _reader.InterfaceImplTable.GetInterface(_rowId); }
}
public CustomAttributeHandleCollection GetCustomAttributes()
{
return new CustomAttributeHandleCollection(_reader, Handle);
}
}
}