我正在寻找任何 LINQ 语法来获得我的数据库频率范围的结果。
SimpleSet 包含一个频率集数组。在每个频率集中,它可以是多个频率。如果一个频率与最小值和最大值 (1000 < 2000) 匹配,则它可以保留在结果列表中。
当前代码:
Dim ret As New ObservableCollection(Of fSimpleItemSet)'the result
Dim FreqMin As Double = 1000
Dim FreqMax As Double = 2000
Dim retTmp As New ObservableCollection(Of fSimpleItemSet)' fSimpleSet is the data collection
retTmp = (From fSimple As fSimpleItemSet In Data Select fSimple) 'Get ALL items
For Each fSimple As fSimpleItemSet In retTmp
If fSimple.fFrequencySet IsNot Nothing Then
For Each fFrequency As fFrequencySet In fSimple.fFrequencySet
If fFrequency.Frequency > FreqMin And fFrequency.Frequency < FreqMax Then
ret.Add(fSimple)
Exit For
End If
Next
End If
Next