本文整理汇总了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;未经允许,请勿转载。 |
请发表评论