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


C# StringHandle类代码示例

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


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

示例1: ImportedMember

        protected ImportedMember(ImportedModule module, StringHandle nameHandle, ImportedType declaringType)
        {
            Module = module;
            DeclaringType = declaringType;

            _nameHandle = nameHandle;
        }
开发者ID:OToL,项目名称:ConcordExtensibilitySamples,代码行数:7,代码来源:ImportedMember.cs

示例2: StartsWith

        public bool StartsWith(StringHandle handle, string value)
        {
            if (value == null)
            {
                Throw.ValueArgumentNull();
            }

            return _reader.StringStream.StartsWith(handle, value, _reader.utf8Decoder);
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:9,代码来源:MetadataStringComparer.cs

示例3: Equals

        public bool Equals(StringHandle handle, string value, bool ignoreCase)
        {
            if (value == null)
            {
                Throw.ValueArgumentNull();
            }

            return _reader.StringHeap.Equals(handle, value, _reader.Utf8Decoder, ignoreCase);
        }
开发者ID:swaroop-sridhar,项目名称:corefx,代码行数:9,代码来源:MetadataStringComparer.cs

示例4: Equals

        public bool Equals(StringHandle handle, string value)
        {
            if (value == null)
            {
                ThrowValueArgumentNull();
            }

            return _reader.StringStream.Equals(handle, value, _reader.utf8Decoder);
        }
开发者ID:svcgany1,项目名称:corefx,代码行数:9,代码来源:MetadataStringComparer.cs

示例5: FormatAssemblyInfo

        private static AssemblyReferenceInformation FormatAssemblyInfo(this MetadataReader metadataReader, string name, StringHandle cultureHandle, BlobHandle publicKeyTokenHandle, Version version)
        {
            var culture = cultureHandle.IsNil
                ? "neutral"
                : metadataReader.GetString(cultureHandle);

            var publicKeyToken = publicKeyTokenHandle.IsNil
                ? "null"
                : metadataReader.FormatPublicKeyToken(publicKeyTokenHandle);

            return new AssemblyReferenceInformation(name, version, culture, publicKeyToken);
        }
开发者ID:AlexGhiondea,项目名称:dotnet-apiport,代码行数:12,代码来源:MetadataReaderExtensions.cs

示例6: GetAttributeNamespaceAndName

        public static bool GetAttributeNamespaceAndName(this MetadataReader metadataReader, CustomAttributeHandle attributeHandle,
            out StringHandle namespaceHandle, out StringHandle nameHandle)
        {
            EntityHandle attributeType, attributeCtor;
            if (!GetAttributeTypeAndConstructor(metadataReader, attributeHandle, out attributeType, out attributeCtor))
            {
                namespaceHandle = default(StringHandle);
                nameHandle = default(StringHandle);
                return false;
            }

            return GetAttributeTypeNamespaceAndName(metadataReader, attributeType, out namespaceHandle, out nameHandle);
        }
开发者ID:niemyjski,项目名称:corert,代码行数:13,代码来源:MetadataExtensions.cs

示例7: GetString

 public static string GetString(this MetadataReader[] readers, StringHandle handle)
 {
     int index = MetadataTokens.GetHeapOffset(handle);
     foreach (var reader in readers)
     {
         int length = reader.GetHeapSize(HeapIndex.String);
         if (index < length)
         {
             return reader.GetString(MetadataTokens.StringHandle(index));
         }
         index -= length;
     }
     return null;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:14,代码来源:MetadataReaderUtils.cs

示例8: GetMetadataNameWithoutBackticks

        private static string GetMetadataNameWithoutBackticks(MetadataReader reader, StringHandle name)
        {
            var blobReader = reader.GetBlobReader(name);
            var backtickIndex = blobReader.IndexOf((byte)'`');
            if (backtickIndex == -1)
            {
                return reader.GetString(name);
            }

            unsafe
            {
                return MetadataStringDecoder.DefaultUTF8.GetString(
                    blobReader.CurrentPointer, backtickIndex);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:15,代码来源:SymbolTreeInfo_Metadata.cs

示例9: ProjectionInfo

 public ProjectionInfo(
     string winRtNamespace,
     StringHandle.VirtualIndex clrNamespace,
     StringHandle.VirtualIndex clrName,
     AssemblyReferenceHandle.VirtualIndex clrAssembly,
     TypeDefTreatment treatment = TypeDefTreatment.RedirectedToClrType,
     bool isIDisposable = false)
 {
     this.WinRTNamespace = winRtNamespace;
     this.ClrNamespace = clrNamespace;
     this.ClrName = clrName;
     this.AssemblyRef = clrAssembly;
     this.Treatment = treatment;
     this.IsIDisposable = isIDisposable;
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:15,代码来源:MetadataReader.WinMD.cs

示例10: NamespaceData

 public NamespaceData(
     StringHandle name,
     string fullName,
     NamespaceDefinitionHandle parent,
     ImmutableArray<NamespaceDefinitionHandle> namespaceDefinitions,
     ImmutableArray<TypeDefinitionHandle> typeDefinitions,
     ImmutableArray<ExportedTypeHandle> exportedTypes)
 {
     this.Name = name;
     this.FullName = fullName;
     this.Parent = parent;
     this.NamespaceDefinitions = namespaceDefinitions;
     this.TypeDefinitions = typeDefinitions;
     this.ExportedTypes = exportedTypes;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:15,代码来源:NamespaceData.cs

示例11: GetAttributeTypeNamespaceAndName

        public static bool GetAttributeTypeNamespaceAndName(this MetadataReader metadataReader, EntityHandle attributeType,
            out StringHandle namespaceHandle, out StringHandle nameHandle)
        {
            namespaceHandle = default(StringHandle);
            nameHandle = default(StringHandle);

            if (attributeType.Kind == HandleKind.TypeReference)
            {
                TypeReference typeRefRow = metadataReader.GetTypeReference((TypeReferenceHandle)attributeType);
                HandleKind handleType = typeRefRow.ResolutionScope.Kind;

                // Nested type?
                if (handleType == HandleKind.TypeReference || handleType == HandleKind.TypeDefinition)
                    return false;

                nameHandle = typeRefRow.Name;
                namespaceHandle = typeRefRow.Namespace;
                return true;
            }
            else if (attributeType.Kind == HandleKind.TypeDefinition)
            {
                var def = metadataReader.GetTypeDefinition((TypeDefinitionHandle)attributeType);

                // Nested type?
                if (IsNested(def.Attributes))
                    return false;

                nameHandle = def.Name;
                namespaceHandle = def.Namespace;
                return true;
            }
            else
            {
                // unsupported metadata
                return false;
            }
        }
开发者ID:niemyjski,项目名称:corert,代码行数:37,代码来源:MetadataExtensions.cs

示例12: CreateRuntimeAssemblyNameFromMetadata

        private static RuntimeAssemblyName CreateRuntimeAssemblyNameFromMetadata(
            MetadataReader reader,
            StringHandle name,
            Version version,
            StringHandle culture,
            BlobHandle publicKeyOrToken,
            AssemblyFlags assemblyFlags)
        {
            AssemblyNameFlags assemblyNameFlags = AssemblyNameFlags.None;
            if (0 != (assemblyFlags & AssemblyFlags.PublicKey))
                assemblyNameFlags |= AssemblyNameFlags.PublicKey;
            if (0 != (assemblyFlags & AssemblyFlags.Retargetable))
                assemblyNameFlags |= AssemblyNameFlags.Retargetable;
            int contentType = ((int)assemblyFlags) & 0x00000E00;
            assemblyNameFlags |= (AssemblyNameFlags)contentType;

            return new RuntimeAssemblyName(
                name.GetString(reader),
                version,
                culture.GetString(reader),
                assemblyNameFlags,
                reader.GetBlobContent(publicKeyOrToken).ToArray()
                );
        }
开发者ID:nattress,项目名称:corert,代码行数:24,代码来源:MetadataReaderExtensions.Ecma.cs

示例13: AddEvent

 public void AddEvent(EventAttributes attributes, StringHandle name, EntityHandle type)
 {
     _eventTable.Add(new EventRow
     {
         EventFlags = (ushort)attributes,
         Name = name,
         EventType = (uint)CodedIndex.ToTypeDefOrRef(type)
     });
 }
开发者ID:tzetang,项目名称:corefx,代码行数:9,代码来源:MetadataBuilder.Tables.cs

示例14: IsValidIdentifier

        private static bool IsValidIdentifier(MetadataReader reader, StringHandle handle)
        {
            var name = reader.GetString(handle);
            for (int i=  0; i < name.Length; i++)
            {
                switch (name[i])
                {
                    case '<':
                    case '>':
                    case '$':
                        return false;
                }
            }

            return true;
        }
开发者ID:Eyas,项目名称:roslyn,代码行数:16,代码来源:AssemblyScheduler.cs

示例15: GetAttributeTypeNameRaw

        private bool GetAttributeTypeNameRaw(CustomAttributeHandle caHandle, out StringHandle namespaceName, out StringHandle typeName)
        {
            namespaceName = typeName = default(StringHandle);

            EntityHandle typeDefOrRef = GetAttributeTypeRaw(caHandle);
            if (typeDefOrRef.IsNil)
            {
                return false;
            }

            if (typeDefOrRef.Kind == HandleKind.TypeReference)
            {
                TypeReferenceHandle typeRef = (TypeReferenceHandle)typeDefOrRef;
                var resolutionScope = TypeRefTable.GetResolutionScope(typeRef);

                if (!resolutionScope.IsNil && resolutionScope.Kind == HandleKind.TypeReference)
                {
                    // we don't need to handle nested types
                    return false;
                }

                // other resolution scopes don't affect full name

                typeName = TypeRefTable.GetName(typeRef);
                namespaceName = TypeRefTable.GetNamespace(typeRef);
            }
            else if (typeDefOrRef.Kind == HandleKind.TypeDefinition)
            {
                TypeDefinitionHandle typeDef = (TypeDefinitionHandle)typeDefOrRef;

                if (TypeDefTable.GetFlags(typeDef).IsNested())
                {
                    // we don't need to handle nested types
                    return false;
                }

                typeName = TypeDefTable.GetName(typeDef);
                namespaceName = TypeDefTable.GetNamespace(typeDef);
            }
            else
            {
                // invalid metadata
                return false;
            }

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


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