Set.IsProperSubsetOf<'T> 方法 (F#)
如果第一个集合中的所有元素均位于第二个集合中,并且第二个集合中至少有一个元素不在第一个集合中,则计算结果为 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>要作为测试依据的集合。
返回值
如果此集合是 otherSet 的真子集,则为 true。 否则,返回 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)
Output
平台
Windows 8,Windows 7,Windows server 2012中,Windows server 2008 R2
版本信息
F#核心库版本
支持:2.0,4.0,可移植