diff --git a/ICSharpCode.Decompiler/NRExtensions.cs b/ICSharpCode.Decompiler/NRExtensions.cs index 2d978a777..58850d2b8 100644 --- a/ICSharpCode.Decompiler/NRExtensions.cs +++ b/ICSharpCode.Decompiler/NRExtensions.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; +using System.Reflection.Metadata; using ICSharpCode.Decompiler.Documentation; using ICSharpCode.Decompiler.TypeSystem; @@ -99,5 +99,13 @@ namespace ICSharpCode.Decompiler return null; return docProvider.GetDocumentation(entity); } + + internal static System.Reflection.TypeAttributes GetMetadataAttributes(this ITypeDefinition type) + { + var metadata = type.ParentModule.MetadataFile?.Metadata; + if (metadata == null || type.MetadataToken.IsNil) + return 0; + return metadata.GetTypeDefinition((TypeDefinitionHandle)type.MetadataToken).Attributes; + } } }