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


C# HtmlNodeCollection.Count方法代码示例

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


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

示例1: SetFinancialRatios

 private void SetFinancialRatios( HtmlNodeCollection nodes )
 {
     if ( nodes == null || nodes.Count( ) == 0 ) return;
     // First Column contains ([] represents index in array):
     // Range[0], 52Week[1], Open[2], Vol/Avg[3], Market Cap[4], P/E[5]
     string [] firstCol = nodes [ 0 ].ChildNodes.Where( i => i.InnerText != "\n" )
         .Select( ( i ) => i.InnerText ).ToArray<string>( ).Select( i => i.Replace( "\n", " " )
         .Substring( 1, i.Length - 1 ) ).ToArray<string>( );
     var range = ParseRange( firstCol [ 0 ] );
     RangeLow = range [ 0 ];
     RangeHigh = range [ 1 ];
     var _52Week = Parse52Week( firstCol [ 1 ] );
     FiftyTwoWeekLow = _52Week [ 0 ];
     FiftyTwoWeekHigh = _52Week [ 1 ];
     Open = ParseOpen( firstCol [ 2 ] ) != null ? Convert.ToDouble( ParseOpen( firstCol [ 2 ] ) ) : 0;
     var vol = ParseVolume( firstCol [ 3 ] );
     VolumeAverage = vol [ 0 ];
     VolumeTotal = vol [ 1 ];
     MarketCap = ParseMarketCap( firstCol [ 4 ] );
     PriceEarnings = ParsePriceEarnings( firstCol [ 5 ] );
     // Second Column contains ([] represents index in array):
     // Div/Yield[0], EPS[1], Shares[2], Beta[3], Instituional Ownership[4]
     string [] secondCol = nodes [ 1 ].ChildNodes.Where( i => i.InnerText != "\n" )
             .Select( i => i.InnerText ).ToArray<string>( )
             .Select( i => i.Replace( "\n", " " ) ).ToArray<string>( );
     var divs = ParseDividend( secondCol [ 0 ] );
     Dividend = divs != null ? divs [ 0 ] : null;
     DividendYield = divs != null ? divs [ 1 ] : null;
     EarningsPerShare = ParseEarningsPerShare( secondCol [ 1 ] );
     if ( secondCol.Length >= 4 )
     {
         Shares = ParseShares( secondCol [ 2 ] );
         Beta = ParseBeta( secondCol [ 3 ] );
         InstitutionalOwnership = ParseInstituionalOwnership( secondCol [ 4 ] );
     }
     else
     {
         // TODO: Implement sparse information case here!
     }
 }
开发者ID:kamalm87,项目名称:KNMFin,代码行数:40,代码来源:Google.cs

示例2: SetRelatedPersons

        private void SetRelatedPersons( HtmlNodeCollection nodes )
        {
            var baseQ = nodes [ nodes.Count( ) - 1 ].SelectSingleNode( ".//table[contains(@class, 'id-mgmt-table')]" );
            if ( baseQ == null ) return;

            OfficersAndDirectors = new List<ImportantPerson>( );
            var ppl = nodes [ nodes.Count( ) - 1 ].SelectSingleNode( ".//table[contains(@class, 'id-mgmt-table')]" )
                            .SelectNodes( ".//tr//td[contains(@class, 'p ')]" ).Select( i => i.InnerText.Replace( "\n\n", ": " )
                            .Replace( "\n", "" ) ).ToArray<string>( );
            foreach ( string person in ppl )
            {
                var b = person.Split( ':' );
                OfficersAndDirectors.Add( new ImportantPerson { Name = b [ 0 ], Role = b [ 1 ].Substring( 1 ) } );
            }
        }
开发者ID:kamalm87,项目名称:KNMFin,代码行数:15,代码来源:Google.cs

示例3: SetSectorsAndIndustries

        private void SetSectorsAndIndustries( HtmlNodeCollection nodes )
        {
            if ( nodes.Count( ) < 8 ) return;

            var externalLinks = nodes [ 5 ].ChildNodes.Select( i => new { i.InnerText, i.InnerHtml } );
            var sectorAndIndustry = nodes [ 6 ].ChildNodes.Where( i => i.InnerText != "\n" ).Select( i => i.InnerText ).ToArray<string>( );
            int sectorIndex = sectorAndIndustry [ 0 ].IndexOf( "Sector:" ) + 7;
            int sectorIndexEnd = sectorAndIndustry [ 0 ].IndexOf( " &gt;" );
            if ( sectorIndexEnd == -1 ) return;
            int industryIndex = sectorAndIndustry [ 0 ].IndexOf( "Industry:" ) + 9;
            int endingMark = sectorAndIndustry [ 0 ].IndexOf( "\n\n" ) + 9;
            Sector = sectorAndIndustry [ 0 ].Substring( sectorIndex + 1, sectorIndexEnd - sectorIndex - 1 ).Replace( "&amp;", "&" );
            Industry = sectorAndIndustry [ 0 ].Substring( industryIndex + 1, endingMark - industryIndex - 10 ).Replace( "&amp;", "&" );
            Description = nodes [ 7 ].ChildNodes.Where( i => i.InnerText != "\n" ).Select( i => i.InnerText ).ToArray<string>( ) [ 0 ].Replace( "More from Reuters &raquo;", "" ).Replace( "\n", "" );
        }
开发者ID:kamalm87,项目名称:KNMFin,代码行数:15,代码来源:Google.cs

示例4: FilterPage

 protected override bool FilterPage(HtmlNodeCollection pictureHtmlNode, ref int pageNum)
 {
     if (base.FilterPage(pictureHtmlNode, ref pageNum))
     {
         return true;
     }
     if (pictureHtmlNode.Count() <= 1)
     {
         var picNode = pictureHtmlNode.FirstOrDefault();
         if (picNode == null)
         {
             pageNum = 500;
             return true;
         }
         var picturePathName = picNode.Attributes["src"].Value;
         if (picturePathName.Contains("bctp_28.gif"))
         {
             pageNum = 500;
             return true;
         }
     }
     return false;
 }
开发者ID:key-value,项目名称:CollectionApplication,代码行数:23,代码来源:PictureSecretary.cs


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