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 // See the LICENSE file in the project root for more information. 4 5 using System.Diagnostics; 6 using System.Reflection.Metadata.Ecma335; 7 8 namespace System.Reflection.Metadata 9 { 10 public readonly struct DeclarativeSecurityAttribute 11 { 12 private readonly MetadataReader _reader; 13 14 // Workaround: JIT doesn't generate good code for nested structures, so use RowId. 15 private readonly int _rowId; 16 DeclarativeSecurityAttributeSystem.Reflection.Metadata.DeclarativeSecurityAttribute17 internal DeclarativeSecurityAttribute(MetadataReader reader, int rowId) 18 { 19 Debug.Assert(reader != null); 20 Debug.Assert(rowId != 0); 21 22 _reader = reader; 23 _rowId = rowId; 24 } 25 26 public DeclarativeSecurityAction Action 27 { 28 get 29 { 30 return _reader.DeclSecurityTable.GetAction(_rowId); 31 } 32 } 33 34 public EntityHandle Parent 35 { 36 get 37 { 38 return _reader.DeclSecurityTable.GetParent(_rowId); 39 } 40 } 41 42 public BlobHandle PermissionSet 43 { 44 get 45 { 46 return _reader.DeclSecurityTable.GetPermissionSet(_rowId); 47 } 48 } 49 } 50 } 51