< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 16
Coverable lines: 16
Total lines: 70
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/Constant.cs

#LineLine coverage
 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
 4namespace System.Reflection.Metadata
 5{
 6    public readonly struct Constant
 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 Constant(MetadataReader reader, int rowId)
 014        {
 015            _reader = reader;
 016            _rowId = rowId;
 017        }
 18
 19        private ConstantHandle Handle
 20        {
 21            get
 022            {
 023                return ConstantHandle.FromRowId(_rowId);
 024            }
 25        }
 26
 27        /// <summary>
 28        /// The type of the constant value.
 29        /// </summary>
 30        /// <remarks>
 31        /// Corresponds to Type field of Constant table in ECMA-335 Standard.
 32        /// </remarks>
 33        public ConstantTypeCode TypeCode
 34        {
 35            get
 036            {
 037                return _reader.ConstantTable.GetType(Handle);
 038            }
 39        }
 40
 41        /// <summary>
 42        /// The constant value.
 43        /// </summary>
 44        /// <remarks>
 45        /// Corresponds to Value field of Constant table in ECMA-335 Standard.
 46        /// </remarks>
 47        public BlobHandle Value
 48        {
 49            get
 050            {
 051                return _reader.ConstantTable.GetValue(Handle);
 052            }
 53        }
 54
 55        /// <summary>
 56        /// The parent handle (<see cref="ParameterHandle"/>, <see cref="FieldDefinitionHandle"/>, or <see cref="Propert
 57        /// </summary>
 58        /// <remarks>
 59        /// Corresponds to Parent field of Constant table in ECMA-335 Standard.
 60        /// </remarks>
 61        public EntityHandle Parent
 62        {
 63            get
 064            {
 065                return _reader.ConstantTable.GetParent(Handle);
 066            }
 67        }
 68    }
 69}
 70