Arrays F#将int数组选项连接到字符串

Arrays F#将int数组选项连接到字符串,arrays,f#,Arrays,F#,我有一个数据合同(WCF),其字段定义为: [<DataContract(Namespace = _Namespace.ws)>] type CommitRequest = { // Excluded for brevity ... [<field: DataMember(Name="ExcludeList", IsRequired=false) >] ExcludeList : int array option } 编译和执行,但都没有给出字符串中的任何内容。如果有人

我有一个数据合同(WCF),其字段定义为:

[<DataContract(Namespace = _Namespace.ws)>]
type CommitRequest =
{
// Excluded for brevity
...
[<field: DataMember(Name="ExcludeList", IsRequired=false) >]
ExcludeList : int array option
}
编译和执行,但都没有给出字符串中的任何内容。如果有人指出我在这里做错了什么,我将不胜感激

let intoArray : int array option = Some [| 1; 23; 16 |]
let strList = intoArray.Value |> Array.map string
let idString = String.concat "," strList // don't need comma between params
// Next try using .NET Join
let idList = System.String.Join (",", strList) // that also works
输出:

> 
val intoArray : int array option = Some [|1; 23; 16|]
val strList : string [] = [|"1"; "23"; "16"|]
val idString : string = "1,23,16"
val idList : string = "1,23,16"

我不会使用F#中选项的Value属性,它主要用于C
match intoArray with Some items->items |>Array.map string | None->Array.empty
我明白了,逗号是造成问题的原因-有时最愚蠢的事情会浪费很多时间。谢谢你,彼得!我同意乔尔的建议。
> 
val intoArray : int array option = Some [|1; 23; 16|]
val strList : string [] = [|"1"; "23"; "16"|]
val idString : string = "1,23,16"
val idList : string = "1,23,16"