當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript linq.IEnumerable類代碼示例

本文整理匯總了TypeScript中linq.IEnumerable的典型用法代碼示例。如果您正苦於以下問題:TypeScript IEnumerable類的具體用法?TypeScript IEnumerable怎麽用?TypeScript IEnumerable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IEnumerable類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should do type completion for joins', function () {
     let other = Enumerable.from(['a', 'aaa']);
     let actual: IEnumerable<string> = Enumerable
         .range(1, 4)
         .join(other, num => num, str => str.length, (num, len) => num + ':' + len);
     expect(actual.toJoinedString(',')).to.equal('1:a,3:aaa');
 });
開發者ID:dflor003,項目名稱:typed-linq,代碼行數:7,代碼來源:test.ts

示例2: bestAndWorstMovies

  public static bestAndWorstMovies(movies: IEnumerable<Movie>): BestAndWorstMovies {
    if (!movies.any((m) => m.rating != null)) {
      return new BestAndWorstMovies([], []);
    }
    const bestMovieRating = movies.where((m) => m.rating !== null).max((m) => m.rating || 0);
    const worstMovieRating = movies.where((m) => m.rating !== null).min((m) => m.rating || 0);
    const bestMovies = movies.where((m) => m.rating === bestMovieRating).toArray();
    const worstMovies = movies.where((m) => m.rating === worstMovieRating).toArray();

    return new BestAndWorstMovies(bestMovies, worstMovies);
  }
開發者ID:snickroger,項目名稱:FantasyMovieLeague,代碼行數:11,代碼來源:movieHelpers.ts

示例3: totalSharesByMovie

 public static totalSharesByMovie(shares: IEnumerable<Share>, players: IEnumerable<Player>): number {
   return shares
     .where((s) => players.any((p) => p.id === s.playerId))
     .select((v) => v.numShares)
     .sum();
 }
開發者ID:snickroger,項目名稱:FantasyMovieLeague,代碼行數:6,代碼來源:movieHelpers.ts

示例4: moviesForNewPage

 public static moviesForNewPage(movies: IEnumerable<Movie>): MovieNewDisplay[] {
   return movies.orderBy((movie) => movie.releaseDate).thenBy((movie) => movie.id).select(
     (movie) => new MovieNewDisplay(movie)).toArray();
 }
開發者ID:snickroger,項目名稱:FantasyMovieLeague,代碼行數:4,代碼來源:movieHelpers.ts

示例5: maxEarningByMovie

 public static maxEarningByMovie(earnings: IEnumerable<Earning>): number {
   const maxEarning = earnings.count() === 0 ? 0 :
     earnings.orderByDescending((e) => e.createdAt).first().gross;
   return maxEarning;
 }
開發者ID:snickroger,項目名稱:FantasyMovieLeague,代碼行數:5,代碼來源:movieHelpers.ts

示例6:

 .where((s) => players.any((p) => p.id === s.playerId))
開發者ID:snickroger,項目名稱:FantasyMovieLeague,代碼行數:1,代碼來源:movieHelpers.ts


注:本文中的linq.IEnumerable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。