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


C# XAttribute.ToString方法代码示例

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


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

示例1: InvalidAttributeDateValueException

 public InvalidAttributeDateValueException(XAttribute a)
     : base(string.Format(
             "{0}:{1} Invalid date format given for attribute. Format must be \"yyyy-MM-dd hh:mm:ss\". <{2} {3}>",
             a.Document.BaseUri,
             ((IXmlLineInfo)a).LineNumber, a.Parent.Name, a.ToString()))
 {
 }
开发者ID:schmidt4brains,项目名称:TimberWinR,代码行数:7,代码来源:ConfigurationErrors.cs

示例2: TryParseAttributeSearchResult

 private SearchResult TryParseAttributeSearchResult(XAttribute attribute)
 {
     if(attribute == null)
     {
         return null;
     }
     var searchResult = new SearchResult {Value = attribute.ToString(), SelectionLength = attribute.Name.LocalName.Length};
     SetLineInfo(attribute, searchResult);
     return searchResult;
 }
开发者ID:uli-weltersbach,项目名称:XPathInformation,代码行数:10,代码来源:SearchResultFactory.cs

示例3: BindName

            private void BindName(XAttribute attribute, CSharpSyntaxNode originatingSyntax, bool isParameter)
            {
                XmlNameAttributeSyntax attrSyntax = ParseNameAttribute(attribute.ToString(), attribute.Parent.Name.LocalName);

                // CONSIDER: It would be easy to construct an XmlLocation from the XAttribute, so that
                // we could point the user at the actual problem.
                Location sourceLocation = originatingSyntax.Location;

                RecordSyntaxDiagnostics(attrSyntax, sourceLocation); // Respects DocumentationMode.

                MemberDeclarationSyntax memberDeclSyntax = BinderFactory.GetAssociatedMemberForXmlSyntax(originatingSyntax);
                Debug.Assert(memberDeclSyntax != null,
                    "Why are we processing a documentation comment that is not attached to a member declaration?");

                DiagnosticBag nameDiagnostics = DiagnosticBag.GetInstance();
                Binder binder = MakeNameBinder(isParameter, memberSymbol, compilation);
                DocumentationCommentCompiler.BindName(attrSyntax, binder, memberSymbol, ref documentedParameters, ref documentedTypeParameters, nameDiagnostics);
                RecordBindingDiagnostics(nameDiagnostics, sourceLocation); // Respects DocumentationMode.
                nameDiagnostics.Free();
            }
开发者ID:riversky,项目名称:roslyn,代码行数:20,代码来源:DocumentationCommentCompiler.IncludeElementExpander.cs

示例4: SpecialAttribHandling

        private string SpecialAttribHandling(XAttribute attrib)
        {
            switch (attrib.Name.LocalName)
            {
                case "Name":
                    this.namedElements.Add(attrib.Value);
                    if (String.IsNullOrEmpty(attrib.Name.Namespace.NamespaceName))
                    {
                        return String.Format("x:{0}", attrib);
                    }

                    return attrib.ToString();

                case "Key":
                    this.keyedElements.Add(attrib.Value);
                    if (String.IsNullOrEmpty(attrib.Name.Namespace.NamespaceName))
                    {
                        return String.Format("x:{0}", attrib);
                    }

                    return attrib.ToString();

                default:
                    if (attrib.Value == "#FF000000")
                    {
                        Debugger.Break();
                    }

                    if (attrib.ToString().StartsWith("xmlns:"))
                    {
                        this.namespaces.Add(attrib.Name.LocalName);
                    }
                    if (this.replaceList.ContainsKey(attrib.Value))
                    {
                        return String.Format("{1}=\"{0}\"", this.replaceList[attrib.Value], attrib.Name.LocalName);
                    }

                    return attrib.ToString();
            }
        }
开发者ID:Benrnz,项目名称:XamlXmlFormatter,代码行数:40,代码来源:XamlXmlFormatter.cs

示例5: GetNamespacePrefixFromXmlnsDeclaration

 private string GetNamespacePrefixFromXmlnsDeclaration(XAttribute attribute)
 {
     var attr = attribute.ToString();
     var match = Regex.Match(attr, @"^xmlns:(?'NamespacePrefix'\w+)=");
     return match.Success ? match.Groups["NamespacePrefix"].Value : string.Empty;
 }
开发者ID:uli-weltersbach,项目名称:XPathInformation,代码行数:6,代码来源:SimpleXmlNamespaceResolver.cs

示例6: GetNamespacePrefix

 private string GetNamespacePrefix(XAttribute attribute)
 {
     var attr = attribute.ToString();
     var match = Regex.Match(attr, @"^(?'NamespacePrefix'\w+):");
     return match.Success ? match.Groups["NamespacePrefix"].Value : string.Empty;
 }
开发者ID:uli-weltersbach,项目名称:XPathInformation,代码行数:6,代码来源:SimpleXmlNamespaceResolver.cs

示例7: LogError

        private void LogError(int errorId, XAttribute attribute, string message)
        {
            int lineStart = (attribute as IXmlLineInfo).LineNumber;
            int columnStart = (attribute as IXmlLineInfo).LinePosition + attribute.ToString().Length - attribute.Value.Length - 1;
            int lineEnd = lineStart;
            int columnEnd = columnStart + attribute.Value.Length;

            // OriginalAndroidManifest contains exactly one element. This has been checked in a previous build-step.
            this.LogError(errorId, this.OriginalAndroidManifest[0].ItemSpec, lineStart, columnStart, lineEnd, columnEnd, message);
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:10,代码来源:CheckAndroidVersionInManifest.cs

示例8: InvalidAttributeValueException

 public InvalidAttributeValueException(XAttribute a)
     : base(string.Format("{0}:{1} Invalid Attribute Value <{2} {3}>", a.Document.BaseUri,
             ((IXmlLineInfo)a).LineNumber, a.Parent.Name, a.ToString()))
 {
 }
开发者ID:schmidt4brains,项目名称:TimberWinR,代码行数:5,代码来源:ConfigurationErrors.cs


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