大佬教程收集整理的这篇文章主要介绍了c# – 带有被动扩展的分区序列,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
var source = new[] { 'a','b',';','c','d','e',';' }.ToObservable();
这是你要求的:
var groups = source // Group the elements by some constant (0) // and end the group when we see a semicolon .GroupByUntil(x => 0,group => group.Where(x => x == ';'))
这是一种使用它的方法:
groups // Log that we're on the next group Now. .Do(x => Console.WriteLine("Group: ")) // Merge / Concat all the groups together // {{a..b..;}..{C..d..e..;}} => {a..b..;..c..d..e..;} .Merge() // Ignore the semicolons? This is optional,I suppose. .Where(x => x != ';') // Log the characters! .Do(x => Console.WriteLine(" {0}",X)) // Make it so,number One! .Subscribe();
输出:
Group: a b Group: c d e
以上是大佬教程为你收集整理的c# – 带有被动扩展的分区序列全部内容,希望文章能够帮你解决c# – 带有被动扩展的分区序列所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。