Set.IsProperSubsetOf<'T> 方法 (F#)
更新:2010 年 5 月
評估為 true如果第一組的所有項目是位於的第二和第二個至少一個項目不是第一個
命名空間/模組路徑: Microsoft.FSharp.Collections
組件:FSharp.Core (在 FSharp.Core.dll 中)
// Signature:
member this.IsProperSubsetOf : Set<'T> -> bool (requires comparison)
// Usage:
set.IsProperSubsetOf (otherSet)
參數
otherSet
型別:Set<'T>做為測試依據的集合。
傳回值
true如果這個設定是適當的子集otherSet. 否則會傳回 false。
範例
下列程式碼會說明如何使用 IsProperSubsetOf方法。
let set1 = Set.ofList [ 1 .. 6 ]
let set2 = Set.ofList [ 1 .. 5 ]
let set3 = Set.ofList [ 1 .. 6 ]
let set4 = Set.ofList [ 5 .. 10 ]
printfn "%A is a proper subset of %A: %b" set2 set1 (set2.IsProperSubsetOf set1)
printfn "%A is a proper subset of %A: %b" set3 set1 (set3.IsProperSubsetOf set1)
printfn "%A is a proper subset of %A: %b" set4 set1 (set4.IsProperSubsetOf set1)
輸出
平台
Windows 7、Windows Vista SP2、Windows XP SP3、Windows XP x64 SP2、Windows Server 2008 R2、Windows Server 2008 SP2、Windows Server 2003 SP2
版本資訊
F# 執行階段
支援版本:2.0、4.0
Silverlight
支援版本:3
請參閱
參考
Microsoft.FSharp.Collections 命名空間 (F#)
變更記錄
日期 |
History |
原因 |
---|---|---|
2010 年 5 月 |
加入程式碼範例。 |
資訊加強。 |