| File: System\Reflection\Metadata\TypeSystem\TypeSpecification.cs | Web Access |
| Project: src\runtime\src\libraries\System.Reflection.Metadata\src\System.Reflection.Metadata.csproj (System.Reflection.Metadata) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Reflection.Metadata.Ecma335; namespace System.Reflection.Metadata { public readonly struct TypeSpecification { private readonly MetadataReader _reader; // Workaround: JIT doesn't generate good code for nested structures, so use RowId. private readonly int _rowId; internal TypeSpecification(MetadataReader reader, TypeSpecificationHandle handle) { _reader = reader; _rowId = handle.RowId; } private TypeSpecificationHandle Handle { get { return TypeSpecificationHandle.FromRowId(_rowId); } } public BlobHandle Signature { get { return _reader.TypeSpecTable.GetSignature(Handle); } } public TType DecodeSignature<TType, TGenericContext>(ISignatureTypeProvider<TType, TGenericContext> provider, TGenericContext genericContext) { var decoder = new SignatureDecoder<TType, TGenericContext>(provider, _reader, genericContext); var blobReader = _reader.GetBlobReader(Signature); return decoder.DecodeType(ref blobReader); } public CustomAttributeHandleCollection GetCustomAttributes() { return new CustomAttributeHandleCollection(_reader, Handle); } } }