当前位置: 首页>>代码示例>>C#>>正文


C# EntityHandle类代码示例

本文整理汇总了C#中EntityHandle的典型用法代码示例。如果您正苦于以下问题:C# EntityHandle类的具体用法?C# EntityHandle怎么用?C# EntityHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntityHandle类属于命名空间,在下文中一共展示了EntityHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsValidCatchTypeHandle

 internal static bool IsValidCatchTypeHandle(EntityHandle catchType)
 {
     return !catchType.IsNil &&
            (catchType.Kind == HandleKind.TypeDefinition ||
             catchType.Kind == HandleKind.TypeSpecification ||
             catchType.Kind == HandleKind.TypeReference);
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:7,代码来源:ExceptionRegionEncoder.cs

示例2: CilExceptionRegion

 internal CilExceptionRegion(HandlerKind kind, EntityHandle catchType, int startOffset, int filterHandlerStart, int endOffset)
 {
     Kind = kind;
     CatchType = catchType;
     StartOffset = startOffset;
     FilterHandlerStart = filterHandlerStart;
     EndOffset = endOffset;
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:8,代码来源:CilExceptionRegion.cs

示例3: InitializeObsoleteDataFromMetadata

 /// <summary>
 /// Initialize the ObsoleteAttributeData by fetching attributes and decoding ObsoleteAttributeData. This can be 
 /// done for Metadata symbol easily whereas trying to do this for source symbols could result in cycles.
 /// </summary>
 internal static void InitializeObsoleteDataFromMetadata(ref ObsoleteAttributeData data, EntityHandle token, PEModuleSymbol containingModule)
 {
     if (ReferenceEquals(data, ObsoleteAttributeData.Uninitialized))
     {
         ObsoleteAttributeData obsoleteAttributeData = GetObsoleteDataFromMetadata(token, containingModule);
         Interlocked.CompareExchange(ref data, obsoleteAttributeData, ObsoleteAttributeData.Uninitialized);
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:12,代码来源:ObsoleteAttributeHelpers.cs

示例4: GetObsoleteDataFromMetadata

 /// <summary>
 /// Get the ObsoleteAttributeData by fetching attributes and decoding ObsoleteAttributeData. This can be 
 /// done for Metadata symbol easily whereas trying to do this for source symbols could result in cycles.
 /// </summary>
 internal static ObsoleteAttributeData GetObsoleteDataFromMetadata(EntityHandle token, PEModuleSymbol containingModule)
 {
     ObsoleteAttributeData obsoleteAttributeData;
     bool isObsolete = containingModule.Module.HasDeprecatedOrObsoleteAttribute(token, out obsoleteAttributeData);
     Debug.Assert(isObsolete == (obsoleteAttributeData != null));
     Debug.Assert(obsoleteAttributeData == null || !obsoleteAttributeData.IsUninitialized);
     return obsoleteAttributeData;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:12,代码来源:ObsoleteAttributeHelpers.cs

示例5: GetRowNumber

        /// <summary>
        /// Returns the row number of a metadata table entry that corresponds 
        /// to the specified <paramref name="handle"/> in the context of <paramref name="reader"/>.
        /// </summary>
        /// <returns>One based row number.</returns>
        /// <exception cref="ArgumentException">The <paramref name="handle"/> is not a valid metadata table handle.</exception>
        public static int GetRowNumber(this MetadataReader reader, EntityHandle handle)
        {
            if (handle.IsVirtual)
            {
                return MapVirtualHandleRowId(reader, handle);
            }

            return handle.RowId;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:15,代码来源:MetadataTokens.cs

示例6: GetToken

        /// <summary>
        /// Returns the metadata token of the specified <paramref name="handle"/> in the context of <paramref name="reader"/>.
        /// </summary>
        /// <returns>Metadata token.</returns>
        /// <exception cref="NotSupportedException">The operation is not supported for the specified <paramref name="handle"/>.</exception>
        public static int GetToken(this MetadataReader reader, EntityHandle handle)
        {
            if (handle.IsVirtual)
            {
                return (int)handle.Type | MapVirtualHandleRowId(reader, handle);
            }

            return handle.Token;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:14,代码来源:MetadataTokens.cs

示例7: ConvertToTag

        internal static uint ConvertToTag(EntityHandle handle)
        {
            if (handle.Type == TokenTypeIds.FieldDef)
            {
                return (uint)handle.RowId << NumberOfBits | Field;
            }
            else if (handle.Type == TokenTypeIds.ParamDef)
            {
                return (uint)handle.RowId << NumberOfBits | Param;
            }

            return 0;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:HasFieldMarshalTag.cs

示例8: GetCustomDebugInformation

        internal static BlobHandle GetCustomDebugInformation(this MetadataReader reader, EntityHandle parent, Guid kind)
        {
            foreach (var cdiHandle in reader.GetCustomDebugInformation(parent))
            {
                var cdi = reader.GetCustomDebugInformation(cdiHandle);
                if (reader.GetGuid(cdi.Kind) == kind)
                {
                    // return the first record
                    return cdi.Value;
                }
            }

            return default(BlobHandle);
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:14,代码来源:MetadataUtilities.cs

示例9: ExceptionHandlerInfo

 public ExceptionHandlerInfo(
     ExceptionRegionKind kind,
     LabelHandle tryStart, 
     LabelHandle tryEnd,
     LabelHandle handlerStart, 
     LabelHandle handlerEnd, 
     LabelHandle filterStart, 
     EntityHandle catchType)
 {
     Kind = kind;
     TryStart = tryStart;
     TryEnd = tryEnd;
     HandlerStart = handlerStart;
     HandlerEnd = handlerEnd;
     FilterStart = filterStart;
     CatchType = catchType;
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:17,代码来源:ControlFlowBuilder.cs

示例10: ConvertToTag

        internal static uint ConvertToTag(EntityHandle handle)
        {
            uint tokenType = handle.Type;
            uint rowId = (uint)handle.RowId;
            switch (tokenType >> TokenTypeIds.RowIdBitCount)
            {
                case TokenTypeIds.TypeDef >> TokenTypeIds.RowIdBitCount:
                    return rowId << NumberOfBits | TypeDef;

                case TokenTypeIds.MethodDef >> TokenTypeIds.RowIdBitCount:
                    return rowId << NumberOfBits | MethodDef;

                case TokenTypeIds.Assembly >> TokenTypeIds.RowIdBitCount:
                    return rowId << NumberOfBits | Assembly;
            }

            return 0;
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:18,代码来源:HasDeclSecurityTag.cs

示例11: DecodeTupleTypesIfApplicable

        public static TypeSymbol DecodeTupleTypesIfApplicable(
            TypeSymbol metadataType,
            EntityHandle targetSymbolToken,
            PEModuleSymbol containingModule)
        {
            ImmutableArray<string> elementNames;
            var hasTupleElementNamesAttribute = containingModule
                .Module
                .HasTupleElementNamesAttribute(targetSymbolToken, out elementNames);

            // If we have the TupleElementNamesAttribute, but no names, that's
            // bad metadata
            if (hasTupleElementNamesAttribute && elementNames.IsDefaultOrEmpty)
            {
                return new UnsupportedMetadataTypeSymbol();
            }

            return DecodeTupleTypesInternal(metadataType, containingModule.ContainingAssembly, elementNames, hasTupleElementNamesAttribute);
        }
开发者ID:tvsonar,项目名称:roslyn,代码行数:19,代码来源:TupleTypeDecoder.cs

示例12: ConvertToTag

        internal static uint ConvertToTag(EntityHandle token)
        {
            HandleKind tokenKind = token.Kind;
            uint rowId = (uint)token.RowId;
            if (tokenKind == HandleKind.FieldDefinition)
            {
                return rowId << NumberOfBits | Field;
            }
            else if (tokenKind == HandleKind.Parameter)
            {
                return rowId << NumberOfBits | Param;
            }
            else if (tokenKind == HandleKind.PropertyDefinition)
            {
                return rowId << NumberOfBits | Property;
            }

            return 0;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:19,代码来源:HasConstantTag.cs

示例13: GetTypeDefOrRefOrSpecCodedIndex

        internal static int GetTypeDefOrRefOrSpecCodedIndex(EntityHandle typeHandle)
        {
            int tag = 0;
            switch (typeHandle.Kind)
            {
                case HandleKind.TypeDefinition:
                    tag = 0;
                    break;

                case HandleKind.TypeReference:
                    tag = 1;
                    break;

                case HandleKind.TypeSpecification:
                    tag = 2;
                    break;
            }

            return (MetadataTokens.GetRowNumber(typeHandle) << 2) | tag;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:20,代码来源:MetadataUtilities.cs

示例14: DecodeTupleTypesIfApplicable

        public static TypeSymbol DecodeTupleTypesIfApplicable(
            TypeSymbol metadataType,
            EntityHandle targetSymbolToken,
            PEModuleSymbol containingModule)
        {
            Debug.Assert((object)metadataType != null);
            Debug.Assert((object)containingModule != null);

            ImmutableArray<string> elementNames;
            var hasTupleElementNamesAttribute = containingModule
                .Module
                .HasTupleElementNamesAttribute(targetSymbolToken, out elementNames);

            // If we have the TupleElementNamesAttribute, but no names, that's
            // bad metadata
            if (hasTupleElementNamesAttribute && elementNames.IsDefaultOrEmpty)
            {
                return new UnsupportedMetadataTypeSymbol();
            }

            var decoder = new TupleTypeDecoder(elementNames,
                                               containingModule.ContainingAssembly);
            try
            {
                var decoded = decoder.DecodeType(metadataType);
                // If not all of the names have been used, the metadata is bad
                if (!hasTupleElementNamesAttribute ||
                    decoder._namesIndex == 0)
                {
                    return decoded;
                }
            }
            catch (InvalidOperationException)
            {
                // Indicates that the tuple info in the attribute didn't match
                // the type. Bad metadata.
            }

            // Bad metadata
            return new UnsupportedMetadataTypeSymbol();
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:41,代码来源:TupleTypeDecoder.cs

示例15: TransformType

        /// <summary>
        /// Decodes the attributes applied to the given <see paramref="targetSymbol"/> from metadata and checks if <see cref="System.Runtime.CompilerServices.DynamicAttribute"/> is applied.
        /// If so, it transforms the given <see paramref="metadataType"/>, using the decoded dynamic transforms attribute argument,
        /// by replacing each occurrence of <see cref="System.Object"/> type with dynamic type.
        /// If no <see cref="System.Runtime.CompilerServices.DynamicAttribute"/> is applied or the decoded dynamic transforms attribute argument is erroneous,
        /// returns the unchanged <see paramref="metadataType"/>.
        /// </summary>
        /// <remarks>This method is a port of TypeManager::ImportDynamicTransformType from the native compiler.</remarks>
        internal static TypeSymbol TransformType(
            TypeSymbol metadataType,
            int targetSymbolCustomModifierCount,
            EntityHandle targetSymbolToken,
            PEModuleSymbol containingModule,
            RefKind targetSymbolRefKind = RefKind.None)
        {
            Debug.Assert((object)metadataType != null);

            ImmutableArray<bool> dynamicTransformFlags;
            if (containingModule.Module.HasDynamicAttribute(targetSymbolToken, out dynamicTransformFlags))
            {
                return TransformTypeInternal(metadataType, containingModule.ContainingAssembly,
                    targetSymbolCustomModifierCount, targetSymbolRefKind, dynamicTransformFlags,
                    haveCustomModifierFlags: true,
                    checkLength: true);
            }

            // No DynamicAttribute applied to the target symbol, return unchanged metadataType.
            return metadataType;
        }
开发者ID:daking2014,项目名称:roslyn,代码行数:29,代码来源:DynamicTypeDecoder.cs


注:本文中的EntityHandle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。