| | | 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 Parameter |
| | | 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 Parameter(MetadataReader reader, ParameterHandle handle) |
| | 0 | 14 | | { |
| | 0 | 15 | | _reader = reader; |
| | 0 | 16 | | _rowId = handle.RowId; |
| | 0 | 17 | | } |
| | | 18 | | |
| | | 19 | | private ParameterHandle Handle |
| | | 20 | | { |
| | 0 | 21 | | get { return ParameterHandle.FromRowId(_rowId); } |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public ParameterAttributes Attributes |
| | | 25 | | { |
| | | 26 | | get |
| | 0 | 27 | | { |
| | 0 | 28 | | return _reader.ParamTable.GetFlags(Handle); |
| | 0 | 29 | | } |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | public int SequenceNumber |
| | | 33 | | { |
| | | 34 | | get |
| | 0 | 35 | | { |
| | 0 | 36 | | return _reader.ParamTable.GetSequence(Handle); |
| | 0 | 37 | | } |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | public StringHandle Name |
| | | 41 | | { |
| | | 42 | | get |
| | 0 | 43 | | { |
| | 0 | 44 | | return _reader.ParamTable.GetName(Handle); |
| | 0 | 45 | | } |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | public ConstantHandle GetDefaultValue() |
| | 0 | 49 | | { |
| | 0 | 50 | | return _reader.ConstantTable.FindConstant(Handle); |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | public BlobHandle GetMarshallingDescriptor() |
| | 0 | 54 | | { |
| | 0 | 55 | | int marshalRowId = _reader.FieldMarshalTable.FindFieldMarshalRowId(Handle); |
| | 0 | 56 | | if (marshalRowId == 0) |
| | 0 | 57 | | { |
| | 0 | 58 | | return default(BlobHandle); |
| | | 59 | | } |
| | | 60 | | |
| | 0 | 61 | | return _reader.FieldMarshalTable.GetNativeType(marshalRowId); |
| | 0 | 62 | | } |
| | | 63 | | |
| | | 64 | | public CustomAttributeHandleCollection GetCustomAttributes() |
| | 0 | 65 | | { |
| | 0 | 66 | | return new CustomAttributeHandleCollection(_reader, Handle); |
| | 0 | 67 | | } |
| | | 68 | | } |
| | | 69 | | } |
| | | 70 | | |