private string GetBaseTypeName(MetadataReader mdReader, TypeDefinition type) { EntityHandle baseTypeHandle = type.BaseType; if (baseTypeHandle.IsNil) { return(String.Empty); } HandleKind baseTypeHandleKind = baseTypeHandle.Kind; if (baseTypeHandleKind == HandleKind.TypeDefinition) { TypeDefinition baseType = mdReader.GetTypeDefinition((TypeDefinitionHandle)baseTypeHandle); return(mdReader.GetString(baseType.Namespace) + "." + mdReader.GetString(baseType.Name)); } else if (baseTypeHandleKind == HandleKind.TypeSpecification) { TypeSpecification baseType = mdReader.GetTypeSpecification((TypeSpecificationHandle)baseTypeHandle); // Don't have logic to convert signatures to names/strings // NOTE: Enums and Structs can't have user defined base types, so this shouldn't break distinguising enums/structs. return(String.Empty); } else if (baseTypeHandleKind == HandleKind.TypeReference) { TypeReference baseType = mdReader.GetTypeReference((TypeReferenceHandle)baseTypeHandle); return(mdReader.GetString(baseType.Namespace) + "." + mdReader.GetString(baseType.Name)); } return(String.Empty); }
public static BBoxHandle GetSelectionHandle(Rect bounds, HandleKind kind, float rescale) { Vector2 pos; var radius = 4f * rescale; var margin = 4.5f * rescale; if (kind.HasFlag(HandleKind.Right)) { pos.X = bounds.Right + radius + margin; } else if (kind.HasFlag(HandleKind.Left)) { pos.X = bounds.Left - radius - margin; } else { pos.X = .5f * (bounds.Left + bounds.Right); } if (kind.HasFlag(HandleKind.Top)) { pos.Y = bounds.Top + radius + margin; } else if (kind.HasFlag(HandleKind.Bottom)) { pos.Y = bounds.Bottom - radius - margin; } else { pos.Y = .5f * (bounds.Bottom + bounds.Top); } return(new BBoxHandle(kind, pos)); }
private static HasCustomAttribute ToHasCustomAttributeTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return HasCustomAttribute.MethodDef; case HandleKind.FieldDefinition: return HasCustomAttribute.Field; case HandleKind.TypeReference: return HasCustomAttribute.TypeRef; case HandleKind.TypeDefinition: return HasCustomAttribute.TypeDef; case HandleKind.Parameter: return HasCustomAttribute.Param; case HandleKind.InterfaceImplementation: return HasCustomAttribute.InterfaceImpl; case HandleKind.MemberReference: return HasCustomAttribute.MemberRef; case HandleKind.ModuleDefinition: return HasCustomAttribute.Module; case HandleKind.DeclarativeSecurityAttribute: return HasCustomAttribute.DeclSecurity; case HandleKind.PropertyDefinition: return HasCustomAttribute.Property; case HandleKind.EventDefinition: return HasCustomAttribute.Event; case HandleKind.StandaloneSignature: return HasCustomAttribute.StandAloneSig; case HandleKind.ModuleReference: return HasCustomAttribute.ModuleRef; case HandleKind.TypeSpecification: return HasCustomAttribute.TypeSpec; case HandleKind.AssemblyDefinition: return HasCustomAttribute.Assembly; case HandleKind.AssemblyReference: return HasCustomAttribute.AssemblyRef; case HandleKind.AssemblyFile: return HasCustomAttribute.File; case HandleKind.ExportedType: return HasCustomAttribute.ExportedType; case HandleKind.ManifestResource: return HasCustomAttribute.ManifestResource; case HandleKind.GenericParameter: return HasCustomAttribute.GenericParam; case HandleKind.GenericParameterConstraint: return HasCustomAttribute.GenericParamConstraint; case HandleKind.MethodSpecification: return HasCustomAttribute.MethodSpec; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
/// <summary> /// /// </summary> /// <param name="val"></param> internal InputArray(double val) { handle = Marshal.AllocHGlobal(sizeof(double)); Marshal.StructureToPtr(val, handle, false); ptr = NativeMethods.core_InputArray_new_byDouble(handle); handleKind = HandleKind.Double; }
private static bool TryGetHandleRange(ImmutableArray <EntityHandle> handles, HandleKind handleKind, out int start, out int count) { TableIndex tableIndex; MetadataTokens.TryGetTableIndex(handleKind, out tableIndex); int mapIndex = ImmutableArray.BinarySearch <EntityHandle>(handles, MetadataTokens.EntityHandle(tableIndex, 0), TokenTypeComparer.Instance); if (mapIndex < 0) { start = 0; count = 0; return(false); } int s = mapIndex; while (s >= 0 && handles[s].Kind == handleKind) { s--; } int e = mapIndex; while (e < handles.Length && handles[e].Kind == handleKind) { e++; } start = s + 1; count = e - start; return(true); }
/// <summary> /// Gets the <see cref="HeapIndex"/> of the heap corresponding to the specified <see cref="HandleKind"/>. /// </summary> /// <param name="type">Handle type.</param> /// <param name="index">Heap index.</param> /// <returns>True if the handle type corresponds to an Ecma335 heap, false otherwise.</returns> public static bool TryGetHeapIndex(HandleKind type, out HeapIndex index) { switch (type) { case HandleKind.UserString: index = HeapIndex.UserString; return(true); case HandleKind.String: case HandleKind.NamespaceDefinition: index = HeapIndex.String; return(true); case HandleKind.Blob: index = HeapIndex.Blob; return(true); case HandleKind.Guid: index = HeapIndex.Guid; return(true); default: index = 0; return(false); } }
private static HasFieldMarshal ToHasFieldMarshalTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return HasFieldMarshal.Field; case HandleKind.Parameter: return HasFieldMarshal.Param; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static MemberForwarded ToMemberForwardedTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return MemberForwarded.Field; case HandleKind.MethodDefinition: return MemberForwarded.MethodDef; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static MethodDefOrRef ToMethodDefOrRefTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return MethodDefOrRef.MethodDef; case HandleKind.MemberReference: return MethodDefOrRef.MemberRef; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static TypeOrMethodDef ToTypeOrMethodDefTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return TypeOrMethodDef.TypeDef; case HandleKind.MethodDefinition: return TypeOrMethodDef.MethodDef; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
/// <summary> /// Gets the <see cref="TableIndex"/> of the table corresponding to the specified <see cref="HandleKind"/>. /// </summary> /// <param name="type">Handle type.</param> /// <param name="index">Table index.</param> /// <returns>True if the handle type corresponds to an Ecma335 table, false otherwise.</returns> public static bool TryGetTableIndex(HandleKind type, out TableIndex index) { if ((int)type < TableIndexExtensions.Count) { index = (TableIndex)type; return(true); } index = 0; return(false); }
private static CustomAttributeType ToCustomAttributeTypeTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return CustomAttributeType.MethodDef; case HandleKind.MemberReference: return CustomAttributeType.MemberRef; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static HasSemantics ToHasSemanticsTag(HandleKind kind) { switch (kind) { case HandleKind.EventDefinition: return HasSemantics.Event; case HandleKind.PropertyDefinition: return HasSemantics.Property; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static MethodDefOrRef ToMethodDefOrRefTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return(MethodDefOrRef.MethodDef); case HandleKind.MemberReference: return(MethodDefOrRef.MemberRef); default: throw UnexpectedHandleKind(kind); } }
private static TypeDefOrRefOrSpec ToTypeDefOrRefTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return(TypeDefOrRefOrSpec.TypeDef); case HandleKind.TypeReference: return(TypeDefOrRefOrSpec.TypeRef); default: throw UnexpectedHandleKind(kind); } }
private static MemberForwarded ToMemberForwardedTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return(MemberForwarded.Field); case HandleKind.MethodDefinition: return(MemberForwarded.MethodDef); default: throw UnexpectedHandleKind(kind); } }
private static HasSemantics ToHasSemanticsTag(HandleKind kind) { switch (kind) { case HandleKind.EventDefinition: return(HasSemantics.Event); case HandleKind.PropertyDefinition: return(HasSemantics.Property); default: throw UnexpectedHandleKind(kind); } }
private static HasFieldMarshal ToHasFieldMarshalTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return(HasFieldMarshal.Field); case HandleKind.Parameter: return(HasFieldMarshal.Param); default: throw UnexpectedHandleKind(kind); } }
private static CustomAttributeType ToCustomAttributeTypeTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return(CustomAttributeType.MethodDef); case HandleKind.MemberReference: return(CustomAttributeType.MemberRef); default: throw UnexpectedHandleKind(kind); } }
private static TypeOrMethodDef ToTypeOrMethodDefTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return(TypeOrMethodDef.TypeDef); case HandleKind.MethodDefinition: return(TypeOrMethodDef.MethodDef); default: throw UnexpectedHandleKind(kind); } }
private static HasDeclSecurity ToHasDeclSecurityTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return HasDeclSecurity.TypeDef; case HandleKind.MethodDefinition: return HasDeclSecurity.MethodDef; case HandleKind.AssemblyDefinition: return HasDeclSecurity.Assembly; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static HasConstant ToHasConstantTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return HasConstant.Field; case HandleKind.Parameter: return HasConstant.Param; case HandleKind.PropertyDefinition: return HasConstant.Property; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static Implementation ToImplementationTag(HandleKind kind) { switch (kind) { case HandleKind.AssemblyFile: return Implementation.File; case HandleKind.AssemblyReference: return Implementation.AssemblyRef; case HandleKind.ExportedType: return Implementation.ExportedType; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static HasCustomAttributeTag ToHasCustomAttributeTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return(HasCustomAttributeTag.MethodDef); case HandleKind.FieldDefinition: return(HasCustomAttributeTag.Field); case HandleKind.TypeReference: return(HasCustomAttributeTag.TypeRef); case HandleKind.TypeDefinition: return(HasCustomAttributeTag.TypeDef); case HandleKind.Parameter: return(HasCustomAttributeTag.Param); case HandleKind.InterfaceImplementation: return(HasCustomAttributeTag.InterfaceImpl); case HandleKind.MemberReference: return(HasCustomAttributeTag.MemberRef); case HandleKind.ModuleDefinition: return(HasCustomAttributeTag.Module); case HandleKind.DeclarativeSecurityAttribute: return(HasCustomAttributeTag.DeclSecurity); case HandleKind.PropertyDefinition: return(HasCustomAttributeTag.Property); case HandleKind.EventDefinition: return(HasCustomAttributeTag.Event); case HandleKind.StandaloneSignature: return(HasCustomAttributeTag.StandAloneSig); case HandleKind.ModuleReference: return(HasCustomAttributeTag.ModuleRef); case HandleKind.TypeSpecification: return(HasCustomAttributeTag.TypeSpec); case HandleKind.AssemblyDefinition: return(HasCustomAttributeTag.Assembly); case HandleKind.AssemblyReference: return(HasCustomAttributeTag.AssemblyRef); case HandleKind.AssemblyFile: return(HasCustomAttributeTag.File); case HandleKind.ExportedType: return(HasCustomAttributeTag.ExportedType); case HandleKind.ManifestResource: return(HasCustomAttributeTag.ManifestResource); case HandleKind.GenericParameter: return(HasCustomAttributeTag.GenericParam); case HandleKind.GenericParameterConstraint: return(HasCustomAttributeTag.GenericParamConstraint); case HandleKind.MethodSpecification: return(HasCustomAttributeTag.MethodSpec); default: Throw.InvalidArgument_UnexpectedHandleKind(kind); return(0); } }
private static TypeDefOrRefOrSpec ToTypeDefOrRefOrSpecTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return TypeDefOrRefOrSpec.TypeDef; case HandleKind.TypeReference: return TypeDefOrRefOrSpec.TypeRef; case HandleKind.TypeSpecification: return TypeDefOrRefOrSpec.TypeSpec; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static TypeOrMethodDefTag ToTypeOrMethodDefTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return(TypeOrMethodDefTag.TypeDef); case HandleKind.MethodDefinition: return(TypeOrMethodDefTag.MethodDef); default: Throw.InvalidArgument_UnexpectedHandleKind(kind); return(0); } }
private static MethodDefOrRefTag ToMethodDefOrRefTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return(MethodDefOrRefTag.MethodDef); case HandleKind.MemberReference: return(MethodDefOrRefTag.MemberRef); default: Throw.InvalidArgument_UnexpectedHandleKind(kind); return(0); } }
private static HasSemanticsTag ToHasSemanticsTag(HandleKind kind) { switch (kind) { case HandleKind.EventDefinition: return(HasSemanticsTag.Event); case HandleKind.PropertyDefinition: return(HasSemanticsTag.Property); default: Throw.InvalidArgument_UnexpectedHandleKind(kind); return(0); } }
private static MemberForwardedTag ToMemberForwardedTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return(MemberForwardedTag.Field); case HandleKind.MethodDefinition: return(MemberForwardedTag.MethodDef); default: Throw.InvalidArgument_UnexpectedHandleKind(kind); return(0); } }
/// <summary> /// Gets the <see cref="TableIndex"/> of the table corresponding to the specified <see cref="HandleKind"/>. /// </summary> /// <param name="type">Handle type.</param> /// <param name="index">Table index.</param> /// <returns>True if the handle type corresponds to an Ecma335 or Portable PDB table, false otherwise.</returns> public static bool TryGetTableIndex(HandleKind type, out TableIndex index) { // We don't have a HandleKind for PropertyMap, EventMap, MethodSemantics, *Ptr, AssemblyOS, etc. tables, // but one can get ahold of one by creating a handle from a token and getting its Kind. if ((int)type < TableCount && ((1UL << (int)type) & (ulong)TableMask.AllTables) != 0) { index = (TableIndex)type; return(true); } index = 0; return(false); }
private static ResolutionScope ToResolutionScopeTag(HandleKind kind) { switch (kind) { case HandleKind.ModuleDefinition: return ResolutionScope.Module; case HandleKind.ModuleReference: return ResolutionScope.ModuleRef; case HandleKind.AssemblyReference: return ResolutionScope.AssemblyRef; case HandleKind.TypeReference: return ResolutionScope.TypeRef; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static HasCustomDebugInformation ToHasCustomDebugInformationTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return HasCustomDebugInformation.MethodDef; case HandleKind.FieldDefinition: return HasCustomDebugInformation.Field; case HandleKind.TypeReference: return HasCustomDebugInformation.TypeRef; case HandleKind.TypeDefinition: return HasCustomDebugInformation.TypeDef; case HandleKind.Parameter: return HasCustomDebugInformation.Param; case HandleKind.InterfaceImplementation: return HasCustomDebugInformation.InterfaceImpl; case HandleKind.MemberReference: return HasCustomDebugInformation.MemberRef; case HandleKind.ModuleDefinition: return HasCustomDebugInformation.Module; case HandleKind.DeclarativeSecurityAttribute: return HasCustomDebugInformation.DeclSecurity; case HandleKind.PropertyDefinition: return HasCustomDebugInformation.Property; case HandleKind.EventDefinition: return HasCustomDebugInformation.Event; case HandleKind.StandaloneSignature: return HasCustomDebugInformation.StandAloneSig; case HandleKind.ModuleReference: return HasCustomDebugInformation.ModuleRef; case HandleKind.TypeSpecification: return HasCustomDebugInformation.TypeSpec; case HandleKind.AssemblyDefinition: return HasCustomDebugInformation.Assembly; case HandleKind.AssemblyReference: return HasCustomDebugInformation.AssemblyRef; case HandleKind.AssemblyFile: return HasCustomDebugInformation.File; case HandleKind.ExportedType: return HasCustomDebugInformation.ExportedType; case HandleKind.ManifestResource: return HasCustomDebugInformation.ManifestResource; case HandleKind.GenericParameter: return HasCustomDebugInformation.GenericParam; case HandleKind.GenericParameterConstraint: return HasCustomDebugInformation.GenericParamConstraint; case HandleKind.MethodSpecification: return HasCustomDebugInformation.MethodSpec; case HandleKind.Document: return HasCustomDebugInformation.Document; case HandleKind.LocalScope: return HasCustomDebugInformation.LocalScope; case HandleKind.LocalVariable: return HasCustomDebugInformation.LocalVariable; case HandleKind.LocalConstant: return HasCustomDebugInformation.LocalConstant; case HandleKind.ImportScope: return HasCustomDebugInformation.ImportScope; default: throw UnexpectedHandleKind(kind); } }
private static CustomAttributeType ToCustomAttributeTypeTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return CustomAttributeType.MethodDef; case HandleKind.MemberReference: return CustomAttributeType.MemberRef; default: throw UnexpectedHandleKind(kind); } }
private static HasDeclSecurity ToHasDeclSecurityTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return HasDeclSecurity.TypeDef; case HandleKind.MethodDefinition: return HasDeclSecurity.MethodDef; case HandleKind.AssemblyDefinition: return HasDeclSecurity.Assembly; default: throw UnexpectedHandleKind(kind); } }
private static HasSemantics ToHasSemanticsTag(HandleKind kind) { switch (kind) { case HandleKind.EventDefinition: return HasSemantics.Event; case HandleKind.PropertyDefinition: return HasSemantics.Property; default: throw UnexpectedHandleKind(kind); } }
/// <summary> /// Gets the <see cref="HeapIndex"/> of the heap corresponding to the specified <see cref="HandleKind"/>. /// </summary> /// <param name="type">Handle type.</param> /// <param name="index">Heap index.</param> /// <returns>True if the handle type corresponds to an Ecma335 heap, false otherwise.</returns> public static bool TryGetHeapIndex(HandleKind type, out HeapIndex index) { switch (type) { case HandleKind.UserString: index = HeapIndex.UserString; return true; case HandleKind.String: case HandleKind.NamespaceDefinition: index = HeapIndex.String; return true; case HandleKind.Blob: index = HeapIndex.Blob; return true; case HandleKind.Guid: index = HeapIndex.Guid; return true; default: index = 0; return false; } }
private static MethodDefOrRef ToMethodDefOrRefTag(HandleKind kind) { switch (kind) { case HandleKind.MethodDefinition: return MethodDefOrRef.MethodDef; case HandleKind.MemberReference: return MethodDefOrRef.MemberRef; default: throw UnexpectedHandleKind(kind); } }
private static MemberRefParent ToMemberRefParentTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return MemberRefParent.TypeDef; case HandleKind.TypeReference: return MemberRefParent.TypeRef; case HandleKind.ModuleReference: return MemberRefParent.ModuleRef; case HandleKind.MethodDefinition: return MemberRefParent.MethodDef; case HandleKind.TypeSpecification: return MemberRefParent.TypeSpec; default: throw new ArgumentException($"Unexpected kind of handle: {kind}"); } }
private static ResolutionScope ToResolutionScopeTag(HandleKind kind) { switch (kind) { case HandleKind.ModuleDefinition: return ResolutionScope.Module; case HandleKind.ModuleReference: return ResolutionScope.ModuleRef; case HandleKind.AssemblyReference: return ResolutionScope.AssemblyRef; case HandleKind.TypeReference: return ResolutionScope.TypeRef; default: throw UnexpectedHandleKind(kind); } }
private static TypeOrMethodDef ToTypeOrMethodDefTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return TypeOrMethodDef.TypeDef; case HandleKind.MethodDefinition: return TypeOrMethodDef.MethodDef; default: throw UnexpectedHandleKind(kind); } }
private static TypeDefOrRefOrSpec ToTypeDefOrRefOrSpecTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return TypeDefOrRefOrSpec.TypeDef; case HandleKind.TypeReference: return TypeDefOrRefOrSpec.TypeRef; case HandleKind.TypeSpecification: return TypeDefOrRefOrSpec.TypeSpec; default: throw UnexpectedHandleKind(kind); } }
/// <summary> /// Gets the <see cref="TableIndex"/> of the table corresponding to the specified <see cref="HandleKind"/>. /// </summary> /// <param name="type">Handle type.</param> /// <param name="index">Table index.</param> /// <returns>True if the handle type corresponds to an Ecma335 or Portable PDB table, false otherwise.</returns> public static bool TryGetTableIndex(HandleKind type, out TableIndex index) { // We don't have a HandleKind for PropertyMap, EventMap, MethodSemantics, *Ptr, AssemblyOS, etc. tables, // but one can get ahold of one by creating a handle from a token and getting its Kind. if ((int)type < TableCount && ((1UL << (int)type) & (ulong)TableMask.AllTables) != 0) { index = (TableIndex)type; return true; } index = 0; return false; }
private static MemberRefParent ToMemberRefParentTag(HandleKind kind) { switch (kind) { case HandleKind.TypeDefinition: return MemberRefParent.TypeDef; case HandleKind.TypeReference: return MemberRefParent.TypeRef; case HandleKind.ModuleReference: return MemberRefParent.ModuleRef; case HandleKind.MethodDefinition: return MemberRefParent.MethodDef; case HandleKind.TypeSpecification: return MemberRefParent.TypeSpec; default: throw UnexpectedHandleKind(kind); } }
private static Implementation ToImplementationTag(HandleKind kind) { switch (kind) { case HandleKind.AssemblyFile: return Implementation.File; case HandleKind.AssemblyReference: return Implementation.AssemblyRef; case HandleKind.ExportedType: return Implementation.ExportedType; default: throw UnexpectedHandleKind(kind); } }
private static MemberForwarded ToMemberForwardedTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return MemberForwarded.Field; case HandleKind.MethodDefinition: return MemberForwarded.MethodDef; default: throw UnexpectedHandleKind(kind); } }
private static HasFieldMarshal ToHasFieldMarshalTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return HasFieldMarshal.Field; case HandleKind.Parameter: return HasFieldMarshal.Param; default: throw UnexpectedHandleKind(kind); } }
/// <summary> /// Gets the <see cref="TableIndex"/> of the table corresponding to the specified <see cref="HandleKind"/>. /// </summary> /// <param name="type">Handle type.</param> /// <param name="index">Table index.</param> /// <returns>True if the handle type corresponds to an Ecma335 table, false otherwise.</returns> public static bool TryGetTableIndex(HandleKind type, out TableIndex index) { if ((int)type < TableIndexExtensions.Count) { index = (TableIndex)type; return true; } index = 0; return false; }
private static HasConstant ToHasConstantTag(HandleKind kind) { switch (kind) { case HandleKind.FieldDefinition: return HasConstant.Field; case HandleKind.Parameter: return HasConstant.Param; case HandleKind.PropertyDefinition: return HasConstant.Property; default: throw UnexpectedHandleKind(kind); } }
private static Exception UnexpectedHandleKind(HandleKind kind) { return new ArgumentException(SR.Format(SR.UnexpectedHandleKind, kind)); }