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


C# XElement.Get方法代码示例

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


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

示例1: uses_the_default_value

        public void uses_the_default_value()
        {
            var element = new XElement("PropertyGroup");
            element.Add(new XElement("TargetFrameworkVersion", "v4.0"));

            element.Get("AssemblyName", "ClassLibrary1").ShouldEqual("ClassLibrary1");
        }
开发者ID:modulexcite,项目名称:ripple,代码行数:7,代码来源:XElementExtensionsTester.cs

示例2: User

 internal User( WebAgent agent, XElement user )
 {
     this.agent = agent;
     this.username = user.Get( "user_name" );
     this.defaultFormat = user.Get( "user_format_short" );
     this.defaultExpiration = user.Get( "user_expiration" );
     this.avatarUrl = user.Get( "user_avatar_url" );
     this.website = user.Get( "user_website" );
     this.email = user.Get( "user_email" );
     this.location = user.Get( "user_location" );
     this.defaultExposure = user.Get<PasteExposure, int>( "user_private", Int32.Parse );
     this.accountType = user.Get<AccountType, int>( "user_account_type", Int32.Parse );
 }
开发者ID:cherrynguyen9,项目名称:Pastebin.cs,代码行数:13,代码来源:User.cs

示例3: TVDBEpisode

 public TVDBEpisode(XElement element)
 {
     ID = element.GetInt("id").Value;
     Directors = element.Split("Director");
     Name = element.Get("EpisodeName");
     Number = element.GetInt("EpisodeNumber").Value;
     Aired = element.GetDateTime("FirstAired");
     GuestStars = element.Split("GuestStars");
     IMDbID = element.Get("IMDB_ID");
     Language = element.Get("Language");
     Overview = element.Get("Overview");
     Season = element.GetInt("SeasonNumber").Value;
     Writers = element.Split("Writer");
     AbsoluteNumber = element.GetInt("absolute_number");
     Filename = element.Get("filename");
     LastUpdated = element.GetUnixDateTime("lastupdated");
     SeasonID = element.GetInt("seasonid").Value;
     SeriesID = element.GetInt("seriesid").Value;
     Rating = element.GetDouble("Rating");
 }
开发者ID:samuelabj,项目名称:EpisodeTracker,代码行数:20,代码来源:TVDBEpisode.cs

示例4: Metrics

        public static Metrics Metrics(XElement typeNode)
        {
            var memberMetrics = typeNode.Descendants("Member")
                .Where(IsNotGenerated)
                .SelectMany(node => node.Descendants("Metric"));

            var metricsMetaData = new Metrics();
            metricsMetaData[TypeName] = typeNode.Get(Name);
            metricsMetaData[LinesPerMethod] = MemberToxicityFor(LinesOfCode, threasholdLimits[LinesPerMethod], memberMetrics).ToString();
            metricsMetaData[ComplexityPerMethod] = MemberToxicityFor(CyclomaticComplexity, threasholdLimits[CyclomaticComplexity], memberMetrics).ToString();
            metricsMetaData[CouplingPerMethod] = MemberToxicityFor(ClassCoupling, threasholdLimits[ClassCoupling], memberMetrics).ToString();

            return metricsMetaData.ToDictionary();
        }
开发者ID:christianblunden,项目名称:toxicity-cs,代码行数:14,代码来源:MetricsParser.cs

示例5: _getValue

 private object _getValue(XElement element) {
    if (element.HasAttribute("value")) {
       return element.Get("value");
    }
    if (!element.HasElements) {
       return element.Value;
    }
    var valueSet = new Dictionary<string, string>();
    foreach (var child in element.Elements()) {
       var itemTag = child.Name.LocalName;
       if (itemTag != "Value") {
          throw new Exception("Unrecognized tag '{0}'".Substitute(itemTag));
       }
       valueSet.Add(child.Get("name"), child.HasAttribute("value") ? child.Get("value") : child.Value);
    }
    return valueSet;
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:17,代码来源:ConfigurationManager.cs

示例6: Get_StringValue

 public void Get_StringValue()
 {
     string value = "A value to test";
     XElement test = new XElement("Node", value);
     string result = test.Get("", "");
     Assert.AreEqual(string.Compare(value, result), 0);
 }
开发者ID:ChuckSavage,项目名称:XmlLib,代码行数:7,代码来源:XElementExtensionsTest.cs

示例7: Get_IntValue

 public void Get_IntValue()
 {
     int value = 100;
     XElement test = new XElement("Node", value);
     int result = test.Get("", 0);
     Assert.AreEqual(value, result);
 }
开发者ID:ChuckSavage,项目名称:XmlLib,代码行数:7,代码来源:XElementExtensionsTest.cs

示例8: Get_IntAttribute

 public void Get_IntAttribute()
 {
     int value = 100;
     XElement test = new XElement("Node", new XAttribute("A", value));
     int result = test.Get("A", 0);
     Assert.AreEqual(value, result);
 }
开发者ID:ChuckSavage,项目名称:XmlLib,代码行数:7,代码来源:XElementExtensionsTest.cs

示例9: IsNotGenerated

 public static bool IsNotGenerated(XElement node)
 {
     if (node.Attribute("File") == null) return true;
     return !generatedFiles.Contains(node.Get("File").ToLower());
 }
开发者ID:christianblunden,项目名称:toxicity-cs,代码行数:5,代码来源:MetricsParser.cs

示例10: FromXmlOverride

 /// <summary>Override this method on derived script nodes to convert the node to XML.</summary>
 protected virtual void FromXmlOverride(XElement element) {
    SourceCode = element.Value;
    Title = element.Get("title");
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:5,代码来源:ScripNode.cs

示例11: ParseXmlOverride

 /// <summary>Parses the descriptor properties from the given XML object.</summary>
 /// <param name="element">The XML element to parse.</param>
 protected virtual void ParseXmlOverride(XElement element) {
    _bookmark = element.Get("Bookmark");
    _details = element.Get("Details");
    _help = element.Get("Help");
    _isEnabled = element.Get<bool>("IsEnabled", true);
    _isVisible = element.Get<bool>("IsVisible", true);
    _icon = element.Get("Icon");
    _rating = element.Get<int>("Rating", 0).Limit(0,10);
    _subject = element.Get("Subject");
    _text = element.Get("Text");
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:13,代码来源:Descriptor.cs

示例12: FromXmlOverride

 /// <summary/>
 protected override void FromXmlOverride(XElement element) {
    base.FromXmlOverride(element);
    if (element.HasAttribute("operation")) {
       Operation = BplClass.Get(element.Get("operation"));
    }
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:7,代码来源:OperationNode.cs

示例13: Paste

 internal Paste( WebAgent agent, XElement paste )
 {
     this.agent = agent;
     this.key = paste.Get( "paste_key" );
     this.timestamp = paste.Get( "paste_date", Int32.Parse );
     this.title = paste.Get( "paste_title" );
     this.size = paste.Get( "paste_size", Int32.Parse );
     this.expireTimestamp = paste.Get( "paste_expire_date", Int32.Parse );
     this.exposure = paste.Get<PasteExposure, int>( "paste_private", Int32.Parse );
     this.formatName = paste.HasValueFor( "paste_format_long" ) ? paste.Get( "paste_format_long" ) : null;
     this.formatId = paste.HasValueFor( "paste_format_short" ) ? paste.Get( "paste_format_short" ) : null;
     this.url = paste.Get( "paste_url" );
     this.views = paste.Get( "paste_hits", Int32.Parse );
 }
开发者ID:cherrynguyen9,项目名称:Pastebin.cs,代码行数:14,代码来源:Paste.cs

示例14: ParseXmlOverride

 /// <summary>Parses the error message properties from the given XML object.</summary>
 /// <param name="element">The XML element to parse.</param>
 protected virtual void ParseXmlOverride(XElement element) {
    Details = element.Get("Details");
    ErrorCode = element.Get("ErrorCode");
    Help = element.Get("Help");
    Severity = element.Get<Severity>("Severity", Severity.Info);
    Text = element.Get("Text");
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:9,代码来源:ErrorMessage.cs

示例15: ParseXmlOverride

      /// <summary/>
      protected override void ParseXmlOverride(XElement element) {
         base.ParseXmlOverride(element);

         IsExpanded = element.Get<bool>("IsExpanded");
      }
开发者ID:borkaborka,项目名称:gmit,代码行数:6,代码来源:DescriptorGroup.cs


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