问题描述
我正在处理一些C#代码,以解决诸如移动平均值之类的问题,在这些代码中,我经常需要使用List/IEnumerable并处理大块连续数据. F#Seq模块具有强大的窗口函数,该函数接受一个Sequence并返回一系列连续元素的序列.
I am working on some C# code dealing with problems like moving averages, where I often need to take a List / IEnumerable and work on chunks of consecutive data. The F# Seq module has a great function, windowed, which taking in a Sequence, returns a sequence of chunks of consecutive elements.
C#是否具有与LINQ开箱即用的等效功能?
Does C# have an equivalent function out-of-the-box with LINQ?
推荐答案
您总是可以从C#调用SeqModule.Windowed
,只需要引用FSharp.Core.Dll
.函数名称也略有修饰,因此您调用Windowed
而不是windowed
,以使其符合C#大写约定
You can always just call SeqModule.Windowed
from C#, you just need to reference FSharp.Core.Dll
. The function names are also slightly mangled, so you call Windowed
rather than windowed
, so that it fits with the C# capitalisation conventions
这篇关于是否有与C#中的F#序列等效的窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!