• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# StringHandle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddGenericParameter

        public GenericParameterHandle AddGenericParameter(
            EntityHandle parent,
            GenericParameterAttributes attributes,
            StringHandle name,
            int index)
        {
            _genericParamTable.Add(new GenericParamRow
            {
                Flags = (ushort)attributes,
                Name = name,
                Number = (ushort)index,
                Owner = (uint)CodedIndex.ToTypeOrMethodDef(parent)
            });

            return MetadataTokens.GenericParameterHandle(_genericParamTable.Count);
        }
开发者ID:tzetang,项目名称:corefx,代码行数:16,代码来源:MetadataBuilder.Tables.cs


示例17: TryGetAttributeName

        /// <summary>Gets the name of an attribute.</summary>
        /// <param name="reader">The metadata reader.</param>
        /// <param name="attr">The attribute.</param>
        /// <param name="typeNamespaceHandle">The namespace of the attribute.</param>
        /// <param name="typeNameHandle">The name of the attribute.</param>
        /// <returns>true if the name could be retrieved; otherwise, false.</returns>
        private static bool TryGetAttributeName(MetadataReader reader, CustomAttribute attr, out StringHandle typeNamespaceHandle, out StringHandle typeNameHandle)
        {
            EntityHandle ctorHandle = attr.Constructor;
            switch (ctorHandle.Kind)
            {
                case HandleKind.MemberReference:
                    EntityHandle container = reader.GetMemberReference((MemberReferenceHandle)ctorHandle).Parent;
                    if (container.Kind == HandleKind.TypeReference)
                    {
                        TypeReference tr = reader.GetTypeReference((TypeReferenceHandle)container);
                        typeNamespaceHandle = tr.Namespace;
                        typeNameHandle = tr.Name;
                        return true;
                    }
                    break;

                case HandleKind.MethodDefinition:
                    MethodDefinition md = reader.GetMethodDefinition((MethodDefinitionHandle)ctorHandle);
                    TypeDefinition td = reader.GetTypeDefinition(md.GetDeclaringType());
                    typeNamespaceHandle = td.Namespace;
                    typeNameHandle = td.Name;
                    return true;
            }

            // Unusual case, potentially invalid IL
            typeNamespaceHandle = default(StringHandle);
            typeNameHandle = default(StringHandle);
            return false;
        }
开发者ID:swaroop-sridhar,项目名称:corefx,代码行数:35,代码来源:FileVersionInfo.Metadata.cs


示例18: AddExportedType

 public void AddExportedType(
     TypeAttributes attributes,
     StringHandle @namespace,
     StringHandle name,
     EntityHandle implementation,
     int typeDefinitionId)
 {
     _exportedTypeTable.Add(new ExportedTypeRow
     {
         Flags = (uint)attributes,
         Implementation = (uint)CodedIndex.ToImplementation(implementation),
         TypeNamespace = @namespace,
         TypeName = name,
         TypeDefId = (uint)typeDefinitionId
     });
 }
开发者ID:tzetang,项目名称:corefx,代码行数:16,代码来源:MetadataBuilder.Tables.cs


示例19: AddModuleReference

 public void AddModuleReference(StringHandle moduleName)
 {
     _moduleRefTable.Add(new ModuleRefRow
     {
         Name = moduleName
     });
 }
开发者ID:tzetang,项目名称:corefx,代码行数:7,代码来源:MetadataBuilder.Tables.cs


示例20: AddMemberReference

        public MemberReferenceHandle AddMemberReference(
            EntityHandle parent,
            StringHandle name,
            BlobHandle signature)
        {
            _memberRefTable.Add(new MemberRefRow
            {
                Class = (uint)CodedIndex.ToMemberRefParent(parent),
                Name = name,
                Signature = signature
            });

            return MetadataTokens.MemberReferenceHandle(_memberRefTable.Count);
        }
开发者ID:tzetang,项目名称:corefx,代码行数:14,代码来源:MetadataBuilder.Tables.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# StringList类代码示例发布时间:2022-05-24
下一篇:
C# StringFormatter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap