| | | 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 | | using System.Reflection.Metadata.Ecma335; |
| | | 5 | | |
| | | 6 | | namespace System.Reflection.Metadata |
| | | 7 | | { |
| | | 8 | | public enum HandleKind : byte |
| | | 9 | | { |
| | | 10 | | ModuleDefinition = (byte)HandleType.Module, |
| | | 11 | | TypeReference = (byte)HandleType.TypeRef, |
| | | 12 | | TypeDefinition = (byte)HandleType.TypeDef, |
| | | 13 | | FieldDefinition = (byte)HandleType.FieldDef, |
| | | 14 | | MethodDefinition = (byte)HandleType.MethodDef, |
| | | 15 | | Parameter = (byte)HandleType.ParamDef, |
| | | 16 | | InterfaceImplementation = (byte)HandleType.InterfaceImpl, |
| | | 17 | | MemberReference = (byte)HandleType.MemberRef, |
| | | 18 | | Constant = (byte)HandleType.Constant, |
| | | 19 | | CustomAttribute = (byte)HandleType.CustomAttribute, |
| | | 20 | | DeclarativeSecurityAttribute = (byte)HandleType.DeclSecurity, |
| | | 21 | | StandaloneSignature = (byte)HandleType.Signature, |
| | | 22 | | EventDefinition = (byte)HandleType.Event, |
| | | 23 | | PropertyDefinition = (byte)HandleType.Property, |
| | | 24 | | MethodImplementation = (byte)HandleType.MethodImpl, |
| | | 25 | | ModuleReference = (byte)HandleType.ModuleRef, |
| | | 26 | | TypeSpecification = (byte)HandleType.TypeSpec, |
| | | 27 | | AssemblyDefinition = (byte)HandleType.Assembly, |
| | | 28 | | AssemblyFile = (byte)HandleType.File, |
| | | 29 | | AssemblyReference = (byte)HandleType.AssemblyRef, |
| | | 30 | | ExportedType = (byte)HandleType.ExportedType, |
| | | 31 | | GenericParameter = (byte)HandleType.GenericParam, |
| | | 32 | | MethodSpecification = (byte)HandleType.MethodSpec, |
| | | 33 | | GenericParameterConstraint = (byte)HandleType.GenericParamConstraint, |
| | | 34 | | ManifestResource = (byte)HandleType.ManifestResource, |
| | | 35 | | |
| | | 36 | | // Debug handles |
| | | 37 | | Document = (byte)HandleType.Document, |
| | | 38 | | MethodDebugInformation = (byte)HandleType.MethodDebugInformation, |
| | | 39 | | LocalScope = (byte)HandleType.LocalScope, |
| | | 40 | | LocalVariable = (byte)HandleType.LocalVariable, |
| | | 41 | | LocalConstant = (byte)HandleType.LocalConstant, |
| | | 42 | | ImportScope = (byte)HandleType.ImportScope, |
| | | 43 | | CustomDebugInformation = (byte)HandleType.CustomDebugInformation, |
| | | 44 | | |
| | | 45 | | // Heap handles |
| | | 46 | | NamespaceDefinition = (byte)HandleType.Namespace, |
| | | 47 | | UserString = (byte)HandleType.UserString, |
| | | 48 | | String = (byte)HandleType.String, |
| | | 49 | | Blob = (byte)HandleType.Blob, |
| | | 50 | | Guid = (byte)HandleType.Guid, |
| | | 51 | | |
| | | 52 | | // note that the highest bit is reserved for virtual bit on Handle |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | internal static class HandleKindExtensions |
| | | 56 | | { |
| | | 57 | | internal static bool IsHeapHandle(this HandleKind kind) |
| | 0 | 58 | | { |
| | 0 | 59 | | return kind >= HandleKind.NamespaceDefinition; |
| | 0 | 60 | | } |
| | | 61 | | } |
| | | 62 | | } |
| | | 63 | | |