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


C# TypeDefinitionHandle类代码示例

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


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

示例1: CompareTypeReferenceToDefinition

        public static bool CompareTypeReferenceToDefinition(TypeReferenceHandle tr1, MetadataReader mr1, TypeDefinitionHandle td2, MetadataReader mr2)
        {
            // TODO! The correct implementation here is probably to call into the assembly binder, but that's not available due to layering.
            // For now, just implement comparison, which will be equivalent in all cases until we support loading multiple copies of the same assembly

            TypeReference trData1 = mr1.GetTypeReference(tr1);
            TypeDefinition tdData2 = mr2.GetTypeDefinition(td2);

            if (!trData1.TypeName.StringEquals(tdData2.Name.GetConstantStringValue(mr2).Value, mr1))
                return false;

            switch (trData1.ParentNamespaceOrType.HandleType)
            {
                case HandleType.TypeReference:
                    if (tdData2.EnclosingType.IsNull(mr2))
                        return false;

                    return CompareTypeReferenceToDefinition(trData1.ParentNamespaceOrType.ToTypeReferenceHandle(mr1), mr1, tdData2.EnclosingType, mr2);

                case HandleType.NamespaceReference:
                    return CompareNamespaceReferenceToDefinition(trData1.ParentNamespaceOrType.ToNamespaceReferenceHandle(mr1), mr1, tdData2.NamespaceDefinition, mr2);

                default:
                    Debug.Assert(false);
                    throw new BadImageFormatException();
            }
        }
开发者ID:nattress,项目名称:corert,代码行数:27,代码来源:MetadataReaderHelpers.cs

示例2: GetWellKnownTypeDefinitionTreatment

        private TypeDefTreatment GetWellKnownTypeDefinitionTreatment(TypeDefinitionHandle typeDef)
        {
            InitializeProjectedTypes();

            StringHandle name = TypeDefTable.GetName(typeDef);

            int index = StringStream.BinarySearchRaw(s_projectedTypeNames, name);
            if (index < 0)
            {
                return TypeDefTreatment.None;
            }

            StringHandle namespaceName = TypeDefTable.GetNamespace(typeDef);
            if (StringStream.EqualsRaw(namespaceName, StringStream.GetVirtualValue(s_projectionInfos[index].ClrNamespace)))
            {
                return s_projectionInfos[index].Treatment;
            }

            // TODO: we can avoid this comparison if info.DotNetNamespace == info.WinRtNamespace 
            if (StringStream.EqualsRaw(namespaceName, s_projectionInfos[index].WinRTNamespace))
            {
                return s_projectionInfos[index].Treatment | TypeDefTreatment.MarkInternalFlag;
            }

            return TypeDefTreatment.None;
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:26,代码来源:MetadataReader.WinMD.cs

示例3: GetTypeLayout

        internal static ClassLayoutRow GetTypeLayout(this MetadataReader reader, TypeDefinitionHandle typeDef)
        {
            uint rowId = reader.ClassLayoutTable.FindRow(typeDef);
            if (rowId == 0)
            {
                return default(ClassLayoutRow);
            }

            return GetTypeLayout(reader, rowId);
        }
开发者ID:svcgany1,项目名称:corefx,代码行数:10,代码来源:MetadataReaderTestHelpers.cs

示例4: EcmaType

        internal EcmaType(EcmaModule module, TypeDefinitionHandle handle)
        {
            _module = module;
            _handle = handle;

            _typeDefinition = module.MetadataReader.GetTypeDefinition(handle);

            _baseType = this; // Not yet initialized flag

#if DEBUG
            // Initialize name eagerly in debug builds for convenience
            this.ToString();
#endif
        }
开发者ID:noahfalk,项目名称:corert,代码行数:14,代码来源:EcmaType.cs

示例5: RuntimeInspectionOnlyNamedType

        protected RuntimeInspectionOnlyNamedType(MetadataReader reader, TypeDefinitionHandle typeDefinitionHandle)
            : base()
        {
#if DEBUG
            if (!(this.InternalViolatesTypeIdentityRules))
            {
                RuntimeTypeHandle runtimeTypeHandle;
                if (ReflectionCoreExecution.ExecutionEnvironment.TryGetNamedTypeForMetadata(reader, typeDefinitionHandle, out runtimeTypeHandle))
                    Debug.Assert(false, "Type identity violation: You must use a RuntimeEENamedType to represent this type as RH has generated an EEType for it.");
            }
#endif
            _reader = reader;
            _typeDefinitionHandle = typeDefinitionHandle;
            _typeDefinition = _typeDefinitionHandle.GetTypeDefinition(_reader);
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:15,代码来源:RuntimeInspectionOnlyNamedType.cs

示例6: ShouldImportNestedType

        /// <summary>
        /// Returns true if the nested type should be imported. 
        /// </summary>
        public static bool ShouldImportNestedType(this PEModule module, TypeDefinitionHandle typeDef)
        {
            // Currently, it appears that we must import ALL types, even private ones,
            // in order to maintain language semantics. This is because a class may implement
            // private interfaces, and we use the interfaces (even if inaccessible) to determine
            // conversions. For example:
            //
            // public class A: IEnumerable<A.X>
            // { 
            //    private class X: ICloneable {}
            // }
            //
            // Code compiling against A can convert A to IEnumerable<ICloneable>. Knowing this requires
            // importing the type A.X.

            return true;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:20,代码来源:ModuleExtensions.cs

示例7: AddEventMap

 public void AddEventMap(TypeDefinitionHandle declaringType, EventDefinitionHandle eventList)
 {
     _eventMapTable.Add(new EventMapRow
     {
         Parent = (uint)MetadataTokens.GetRowNumber(declaringType),
         EventList = (uint)MetadataTokens.GetRowNumber(eventList)
     });
 }
开发者ID:tzetang,项目名称:corefx,代码行数:8,代码来源:MetadataBuilder.Tables.cs

示例8: AddPropertyMap

 public void AddPropertyMap(TypeDefinitionHandle declaringType, PropertyDefinitionHandle propertyList)
 {
     _propertyMapTable.Add(new PropertyMapRow
     {
         Parent = (uint)MetadataTokens.GetRowNumber(declaringType),
         PropertyList = (uint)MetadataTokens.GetRowNumber(propertyList)
     });
 }
开发者ID:tzetang,项目名称:corefx,代码行数:8,代码来源:MetadataBuilder.Tables.cs

示例9: IsClrImplementationType

        private bool IsClrImplementationType(TypeDefinitionHandle typeDef)
        {
            var attrs = TypeDefTable.GetFlags(typeDef);

            if ((attrs & (TypeAttributes.VisibilityMask | TypeAttributes.SpecialName)) != TypeAttributes.SpecialName)
            {
                return false;
            }

            return StringStream.StartsWithRaw(TypeDefTable.GetName(typeDef), ClrPrefix);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:11,代码来源:MetadataReader.WinMD.cs

示例10: GetFieldRange

        internal void GetFieldRange(TypeDefinitionHandle typeDef, out int firstFieldRowId, out int lastFieldRowId)
        {
            int typeDefRowId = typeDef.RowId;

            firstFieldRowId = this.TypeDefTable.GetFieldStart(typeDefRowId);
            if (firstFieldRowId == 0)
            {
                firstFieldRowId = 1;
                lastFieldRowId = 0;
            }
            else if (typeDefRowId == this.TypeDefTable.NumberOfRows)
            {
                lastFieldRowId = (this.UseFieldPtrTable) ? this.FieldPtrTable.NumberOfRows : this.FieldTable.NumberOfRows;
            }
            else
            {
                lastFieldRowId = this.TypeDefTable.GetFieldStart(typeDefRowId + 1) - 1;
            }
        }
开发者ID:SamuelEnglard,项目名称:corefx,代码行数:19,代码来源:MetadataReader.cs

示例11: ResolveTypeDefinition

 //
 // Main routine to resolve a typeDefinition.
 //
 internal static RuntimeType ResolveTypeDefinition(this ReflectionDomain reflectionDomain, MetadataReader reader, TypeDefinitionHandle typeDefinitionHandle)
 {
     return RuntimeTypeUnifierEx.GetNamedType(reader, typeDefinitionHandle);
 }
开发者ID:noahfalk,项目名称:corert,代码行数:7,代码来源:TypeResolver.cs

示例12: GetInterfaceImplRange

        internal void GetInterfaceImplRange(
            TypeDefinitionHandle typeDef,
            out int firstImplRowId,
            out int lastImplRowId)
        {
            int typeDefRid = typeDef.RowId;

            int startRowNumber, endRowNumber;
            this.Block.BinarySearchReferenceRange(
                this.NumberOfRows,
                this.RowSize,
                _ClassOffset,
                (uint)typeDefRid,
                _IsTypeDefTableRowRefSizeSmall,
                out startRowNumber,
                out endRowNumber);

            if (startRowNumber == -1)
            {
                firstImplRowId = 1;
                lastImplRowId = 0;
            }
            else
            {
                firstImplRowId = startRowNumber + 1;
                lastImplRowId = endRowNumber + 1;
            }
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:28,代码来源:Tables.cs

示例13: FindGenericParametersForType

        internal GenericParameterHandleCollection FindGenericParametersForType(TypeDefinitionHandle typeDef)
        {
            ushort count = 0;
            uint searchCodedTag = TypeOrMethodDefTag.ConvertTypeDefRowIdToTag(typeDef);
            int startRid = (int)this.BinarySearchTag(searchCodedTag, ref count);

            return new GenericParameterHandleCollection(startRid, count);
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:8,代码来源:Tables.cs

示例14: FindEnclosingType

        internal TypeDefinitionHandle FindEnclosingType(TypeDefinitionHandle nestedTypeDef)
        {
            int rowNumber =
              this.Block.BinarySearchReference(
                this.NumberOfRows,
                this.RowSize,
                _NestedClassOffset,
                (uint)nestedTypeDef.RowId,
                _IsTypeDefTableRowRefSizeSmall);

            if (rowNumber == -1)
            {
                return default(TypeDefinitionHandle);
            }

            return TypeDefinitionHandle.FromRowId(this.Block.PeekReference(rowNumber * this.RowSize + _EnclosingClassOffset, _IsTypeDefTableRowRefSizeSmall));
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:17,代码来源:Tables.cs

示例15: GetExtends

 internal EntityHandle GetExtends(TypeDefinitionHandle handle)
 {
     int rowOffset = (handle.RowId - 1) * this.RowSize;
     return TypeDefOrRefTag.ConvertToHandle(this.Block.PeekTaggedReference(rowOffset + _ExtendsOffset, _IsTypeDefOrRefRefSizeSmall));
 }
开发者ID:jmhardison,项目名称:corefx,代码行数:5,代码来源:Tables.cs


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