在C#中,我们可以为属性声明私有的setter。 如何使用F#完成此操作?
具体来说,我如何确保只能在班级内更改属性的状态?
例如,我们如何将FirstName setter属性声明为private,如C#?
public string FirstName { get; private set; }
type SomeViewModel() =
inherit ViewModel()
let mutable firstName = ""
let mutable lastName = ""
member this.FirstName
with get() = firstName
and set(value) =
firstName <- value
base.notifyPropertyChanged(<@ this.FirstName @>)
member this.LastName
with get() = lastName
and set(value) =
lastName <- value
base.notifyPropertyChanged(<@ this.LastName @>)
member this.GetFullName() =
sprintf "%s %s" (this.FirstName) (this.LastName)
答案 0 :(得分:8)
require(igraph)
x<-graph.data.frame(df[,c(1,4)])
#You can also take a look with plot(x)
res<-clusters(x)
split(names(res$membership),res$membership)
#$`1`
#[1] "f_1"
#$`2`
#[1] "f_2" "f_185" "f_408" "f_2334"
#$`3`
#[1] "f_3" "f_7" "f_414" "f_2181" "f_2969"
#$`4`
#[1] "f_4" "f_2271"
#$`5`
#[1] "f_5"
#$`6`
#[1] "f_6" "f_10" "f_747" "f_2068" "f_2929" "f_2970"
这直接显示在MSDN F# documentation。
中答案 1 :(得分:0)
这是UserVoice的建议。
显然,它被认为是F#3.0版本,然后被剪切。 它仍然是“原则上批准的”。