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

C# IAssemblySymbol类代码示例

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

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



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

示例1: AddAssemblyLink

        protected void AddAssemblyLink(IAssemblySymbol assemblySymbol)
        {
            var name = assemblySymbol.Identity.Name;
            var navInfo = _libraryManager.LibraryService.NavInfoFactory.CreateForAssembly(assemblySymbol);

            _description.AddDescriptionText3(name, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
        }
开发者ID:robertoenbarcelona,项目名称:roslyn,代码行数:7,代码来源:AbstractDescriptionBuilder.cs


示例2: AddAssemblyLink

        protected void AddAssemblyLink(IAssemblySymbol assemblySymbol)
        {
            var name = assemblySymbol.Identity.Name;
            var navInfo = _libraryManager.GetAssemblyNavInfo(assemblySymbol);

            _description.AddDescriptionText3(name, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:7,代码来源:AbstractDescriptionBuilder.cs


示例3: GetAssemblyInfo

 public static string GetAssemblyInfo(IAssemblySymbol assemblySymbol)
 {
     return string.Format(
         "{0} {1}",
         FeaturesResources.Assembly,
         assemblySymbol.Identity.GetDisplayName());
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:7,代码来源:MetadataAsSourceHelpers.cs


示例4: IsSameAssemblyOrHasFriendAccessTo

 public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
 {
     return
         Equals(assembly, toAssembly) ||
         (assembly.IsInteractive && toAssembly.IsInteractive) ||
         toAssembly.GivesAccessTo(assembly);
 }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:7,代码来源:IAssemblySymbolExtensions.cs


示例5: IsAccessibleWithin

 /// <summary>
 /// Checks if 'symbol' is accessible from within assembly 'within'.
 /// </summary>
 public static bool IsAccessibleWithin(
     this ISymbol symbol,
     IAssemblySymbol within,
     ITypeSymbol throughTypeOpt = null)
 {
     return IsSymbolAccessibleCore(symbol, within, throughTypeOpt, out var failedThroughTypeCheck);
 }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:10,代码来源:ISymbolExtensions_Accessibility.cs


示例6: CompareTo

 public static IEnumerable<TypeDiff> CompareTo(this IAssemblySymbol assembly, IAssemblySymbol comparedTo)
 {
     var types = assembly.GlobalNamespace.GetTypes();
     var comparedToTypes = comparedTo.GlobalNamespace.GetTypes();
     var result = types.FullOuterJoin(comparedToTypes, NamespaceOrTypeSymbolComparer.Instance, (a, b) => a.CompareTo(b));
     return result;
 }
开发者ID:run00,项目名称:Roslyn,代码行数:7,代码来源:AssemblyExtensions.cs


示例7: ShouldCreateFromScratch

        private static bool ShouldCreateFromScratch(
            Solution solution,
            IAssemblySymbol assembly,
            string filePath,
            out string prefix,
            out VersionStamp version,
            CancellationToken cancellationToken)
        {
            prefix = null;
            version = default(VersionStamp);

            var service = solution.Workspace.Services.GetService<IAssemblySerializationInfoService>();
            if (service == null)
            {
                return true;
            }

            // check whether the assembly that belong to a solution is something we can serialize
            if (!service.Serializable(solution, filePath))
            {
                return true;
            }

            if (!service.TryGetSerializationPrefixAndVersion(solution, filePath, out prefix, out version))
            {
                return true;
            }

            return false;
        }
开发者ID:peter76111,项目名称:roslyn,代码行数:30,代码来源:SymbolTreeInfo_Serialization.cs


示例8: LoadOrCreateAsync

        /// <summary>
        /// this is for a metadata reference in a solution
        /// </summary>
        private static async Task<SymbolTreeInfo> LoadOrCreateAsync(Solution solution, IAssemblySymbol assembly, string filePath, CancellationToken cancellationToken)
        {
            // if assembly is not from a file, just create one on the fly
            if (filePath == null || !File.Exists(filePath) || !FilePathUtilities.PartOfFrameworkOrReferencePaths(filePath))
            {
                return Create(VersionStamp.Default, assembly, cancellationToken);
            }

            // if solution is not from a disk, just create one.
            if (solution.FilePath == null || !File.Exists(solution.FilePath))
            {
                return Create(VersionStamp.Default, assembly, cancellationToken);
            }

            // okay, see whether we can get one from persistence service.
            var relativePath = FilePathUtilities.GetRelativePath(solution.FilePath, filePath);
            var version = VersionStamp.Create(File.GetLastWriteTimeUtc(filePath));

            var persistentStorageService = solution.Workspace.Services.GetService<IPersistentStorageService>();

            // attempt to load from persisted state. metadata reference is solution wise information
            SymbolTreeInfo info;
            using (var storage = persistentStorageService.GetStorage(solution))
            {
                var key = PrefixMetadataSymbolTreeInfo + relativePath;
                using (var stream = await storage.ReadStreamAsync(key, cancellationToken).ConfigureAwait(false))
                {
                    if (stream != null)
                    {
                        using (var reader = new ObjectReader(stream))
                        {
                            info = ReadFrom(reader);
                            if (info != null && VersionStamp.CanReusePersistedVersion(version, info.version))
                            {
                                return info;
                            }
                        }
                    }
                }

                cancellationToken.ThrowIfCancellationRequested();

                // compute it if we couldn't load it from cache
                info = Create(version, assembly, cancellationToken);
                if (info != null)
                {
                    using (var stream = SerializableBytes.CreateWritableStream())
                    using (var writer = new ObjectWriter(stream, cancellationToken: cancellationToken))
                    {
                        info.WriteTo(writer);
                        stream.Position = 0;

                        await storage.WriteStreamAsync(key, stream, cancellationToken).ConfigureAwait(false);
                    }
                }
            }

            return info;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:62,代码来源:SymbolTreeInfo_Serialization.cs


示例9: ExternAliasRecord

        public ExternAliasRecord(string alias, IAssemblySymbol targetAssembly)
        {
            Debug.Assert(alias != null);
            Debug.Assert(targetAssembly != null);

            Alias = alias;
            TargetAssembly = targetAssembly;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:8,代码来源:ExternAliasRecord.cs


示例10: GetAssemblyAttributes

 public static IEnumerable<string> GetAssemblyAttributes(IAssemblySymbol assemblySymbol)
 {
     var attributes = assemblySymbol.GetAttributes();
     foreach (var attribute in attributes)
     {
         yield return attribute.ToString();
     }
 }
开发者ID:rgmills,项目名称:SourceBrowser,代码行数:8,代码来源:MetadataReading.cs


示例11: AssemblyHasPublicTypes

 private static bool AssemblyHasPublicTypes(IAssemblySymbol assembly)
 {
     return assembly
             .GlobalNamespace
             .GetMembers()
             .OfType<INamedTypeSymbol>()
             .Where(s => s.DeclaredAccessibility == Accessibility.Public)
             .Any();
 }
开发者ID:bkoelman,项目名称:roslyn-analyzers,代码行数:9,代码来源:MarkAssembliesWithComVisible.cs


示例12: IsOrUsesAssemblyType

        private static bool IsOrUsesAssemblyType(ITypeSymbol typeSymbol, IAssemblySymbol assemblySymbol)
        {
            if (typeSymbol.ContainingAssembly == assemblySymbol)
            {
                return true;
            }

            INamedTypeSymbol namedTypeSymbol = typeSymbol as INamedTypeSymbol;
            return namedTypeSymbol != null && namedTypeSymbol.IsGenericType
                && namedTypeSymbol.TypeArguments.Any(t => IsOrUsesAssemblyType(t, assemblySymbol));
        }
开发者ID:Azure,项目名称:azure-webjobs-sdk-script,代码行数:11,代码来源:CSharpCompilation.cs


示例13: MetadataSearchScope

 public MetadataSearchScope(
     Solution solution,
     IAssemblySymbol assembly,
     PortableExecutableReference metadataReference,
     bool ignoreCase,
     CancellationToken cancellationToken)
     : base(ignoreCase, cancellationToken)
 {
     _solution = solution;
     _assembly = assembly;
     _metadataReference = metadataReference;
 }
开发者ID:neooleg,项目名称:roslyn,代码行数:12,代码来源:AbstractAddImportCodeFixProvider.SearchScope.cs


示例14: IsObjectMapperFrameworkAssembly

 public static bool IsObjectMapperFrameworkAssembly(IAssemblySymbol assemblySymbol)
 {
     if (assemblySymbol.Name != "ObjectMapper.Framework")
     {
         return false;
     }
     if (!assemblySymbol.Identity.IsStrongName || !_publicKeyToken.SequenceEqual(assemblySymbol.Identity.PublicKeyToken))
     {
         return false;
     }
     return true;
 }
开发者ID:nejcskofic,项目名称:ObjectMapper,代码行数:12,代码来源:FrameworkHelpers.cs


示例15: ImportRecord

 public ImportRecord(
     ImportTargetKind targetKind,
     string alias = null,
     ITypeSymbol targetType = null,
     string targetString = null,
     IAssemblySymbol targetAssembly = null,
     string targetAssemblyAlias = null)
 {
     TargetKind = targetKind;
     Alias = alias;
     TargetType = targetType;
     TargetString = targetString;
     TargetAssembly = targetAssembly;
     TargetAssemblyAlias = targetAssemblyAlias;
 }
开发者ID:binsys,项目名称:roslyn,代码行数:15,代码来源:ImportRecord.cs


示例16: CreateSourceSymbolTreeInfo

        internal static SymbolTreeInfo CreateSourceSymbolTreeInfo(
            Solution solution, VersionStamp version, IAssemblySymbol assembly,
            string filePath, CancellationToken cancellationToken)
        {
            if (assembly == null)
            {
                return null;
            }

            var unsortedNodes = new List<Node> { new Node(assembly.GlobalNamespace.Name, Node.RootNodeParentIndex) };

            GenerateSourceNodes(assembly.GlobalNamespace, unsortedNodes, s_getMembersNoPrivate);

            return CreateSymbolTreeInfo(solution, version, filePath, unsortedNodes);
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:15,代码来源:SymbolTreeInfo_Source.cs


示例17: Find

        /// <summary>
        /// Get all symbols that have a name matching the specified name.
        /// </summary>
        public IEnumerable<ISymbol> Find(
            IAssemblySymbol assembly,
            string name,
            bool ignoreCase,
            CancellationToken cancellationToken)
        {
            var comparer = GetComparer(ignoreCase);

            foreach (var node in FindNodes(name, comparer))
            {
                foreach (var symbol in Bind(node, assembly.GlobalNamespace, cancellationToken))
                {
                    yield return symbol;
                }
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:19,代码来源:SymbolTreeInfo.cs


示例18: Find

 public IEnumerable<ISymbol> Find(IAssemblySymbol assembly, Func<string, bool> predicate, CancellationToken cancellationToken)
 {
     for (int i = 0, n = _nodes.Count; i < n; i++)
     {
         cancellationToken.ThrowIfCancellationRequested();
         var node = _nodes[i];
         if (predicate(node.Name))
         {
             foreach (var symbol in Bind(i, assembly.GlobalNamespace, cancellationToken))
             {
                 cancellationToken.ThrowIfCancellationRequested();
                 yield return symbol;
             }
         }
     }
 }
开发者ID:VPashkov,项目名称:roslyn,代码行数:16,代码来源:SymbolTreeInfo.cs


示例19: CreateSourceSymbolTreeInfo

        internal static SymbolTreeInfo CreateSourceSymbolTreeInfo(
            Solution solution, VersionStamp version, IAssemblySymbol assembly,
            string filePath, CancellationToken cancellationToken)
        {
            if (assembly == null)
            {
                return null;
            }

            var unsortedNodes = ArrayBuilder<BuilderNode>.GetInstance();
            unsortedNodes.Add(new BuilderNode(assembly.GlobalNamespace.Name, RootNodeParentIndex));

            GenerateSourceNodes(assembly.GlobalNamespace, unsortedNodes, s_getMembersNoPrivate);

            return CreateSymbolTreeInfo(
                solution, version, filePath, unsortedNodes.ToImmutableAndFree(), 
                inheritanceMap: new OrderPreservingMultiDictionary<string, string>());
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:18,代码来源:SymbolTreeInfo_Source.cs


示例20: GetAssemblyDisplay

        public static string GetAssemblyDisplay(Compilation compilation, IAssemblySymbol assemblySymbol)
        {
            // This method is only used to generate a comment at the top of Metadata-as-Source documents and
            // previous submissions are never viewed as metadata (i.e. we always have compilations) so there's no
            // need to consume compilation.ScriptCompilationInfo.PreviousScriptCompilation.

            // TODO (https://github.com/dotnet/roslyn/issues/6859): compilation.GetMetadataReference(assemblySymbol)?
            var assemblyReference = compilation.References.Where(r =>
            {
                var referencedSymbol = compilation.GetAssemblyOrModuleSymbol(r) as IAssemblySymbol;
                return
                    referencedSymbol != null &&
                    referencedSymbol.MetadataName == assemblySymbol.MetadataName;
            })
            .FirstOrDefault();

            return assemblyReference?.Display ?? FeaturesResources.location_unknown;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:18,代码来源:MetadataAsSourceHelpers.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IAssert类代码示例发布时间:2022-05-24
下一篇:
C# IAssemblyResolver类代码示例发布时间: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