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


C# IElement.GetReferences方法代码示例

本文整理汇总了C#中IElement.GetReferences方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.GetReferences方法的具体用法?C# IElement.GetReferences怎么用?C# IElement.GetReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IElement的用法示例。


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

示例1: ProcessAfterInterior

        public void ProcessAfterInterior(IElement element)
        {
            Assert.CheckNotNull(element);

            foreach (IReference reference in element.GetReferences())
            {
                IDeclaredElement resolved = reference.Resolve().DeclaredElement;
                if(resolved is IConstructor)
                {
                    resolved = resolved.GetContainingType();
                }

                {
                    ITypeElement typeElement = resolved as ITypeElement;

                    if (typeElement != null)
                    {
                        //                    IDeclaredType declaredType = TypeFactory.CreateType(typeElement);

                        IModule module = resolved.Module;
                        if (candidates.Contains(module))
                            candidates.Remove(module);
                    }
                }

            }
        }
开发者ID:willrawls,项目名称:arp,代码行数:27,代码来源:UnusedModulesProcessor.cs

示例2: ProcessReferences

        protected void ProcessReferences(IElement element)
        {
            if(!CheckElement(element))
                return;

            IReference[] references = element.GetReferences();
            foreach (IReference reference in references)
            {
                CheckForResolveProblems(reference, element);

                if (!reference.IsValid())
                {
                    //ResolveErrorType result = reference.CheckResolveResult();
                    // TODO hightlight "can not resolve symbol 'blahblah' "
                    //if( reference.CheckResolveResult() == ResolveErrorType. ...)
                }
                else
                {
                    HighlightReference(element, reference);
                }

            }
        }
开发者ID:willrawls,项目名称:arp,代码行数:23,代码来源:ReferencesProcessor.cs

示例3: ProcessIdentifiers

        private void ProcessIdentifiers(IElement element)
        {
            IReference[] references = element.GetReferences();
            foreach (IReference reference in references)
            {
                CheckForResolveProblems(reference);

                if(!reference.IsValid())
                {
                    //ResolveErrorType result = reference.CheckResolveResult();
                    // TODO hightlight "can not resolve symbol 'blahblah' "
                    //if( reference.CheckResolveResult() == ResolveErrorType. ...)
                }
                else if(reference.ReferenceType == ReferenceType.TEXT
                    || reference.ReferenceType == ReferenceType.REFERENCE_NAME)
                {
                    ResolveResult resolveResult = reference.Resolve();
                    if(resolveResult.DeclaredElement != null)
                    {
                        DocumentRange range = reference.GetDocumentRange();
                        DocumentRange footerRange = GetFooterTagRange(element, range);
                        Highlight(range, resolveResult.DeclaredElement);
                        if (footerRange != DocumentRange.InvalidRange)
                            Highlight(footerRange, resolveResult.DeclaredElement);
                    }
                }
            }

            if (element is IAppenderRef)
            {
                Highlight(((IXmlTag)element).ToTreeNode().Header.Name, HighlightingAttributeIds.FIELD_IDENTIFIER_ATTRIBUTE);
            }

            // TODO remove double code
            if(element is ILogger &&  ((ILogger)element).TagName == L4NConstants.ROOT_LOGGER)
            {
                IXmlTagNode treeNode = ((IXmlTag)element).ToTreeNode();
                // TODO use ILoggerElement to get header range
                Highlight(treeNode.Header.Name, HighlightingAttributeIds.CONSTANT_IDENTIFIER_ATTRIBUTE);
            }
            else if(element is IAppender || element is ILogger)
            {
                // TODO use IAppenderElement to get header range
                IXmlTagNode treeNode = ((IXmlTag)element).ToTreeNode();
                Highlight(treeNode.Header.Name, HighlightingAttributeIds.TYPE_IDENTIFIER_ATTRIBUTE);
            }

            // TODO tooltips for predefined tags appender, appender-ref, logger, level etc
        }
开发者ID:willrawls,项目名称:arp,代码行数:49,代码来源:L4NProcessor.cs


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