当将 Resizable 数组与任何类型一起使用时,我无法遍历该数组,f# 似乎不理解我的预定义类型。这是一个示例代码:
type someData = {
Entry:string ; id:int }
let datas = new ResizeArray<someData>()
let record1 = {someData.Entry = "hiLo" ;someData.id =1234 }
datas.Add(record1)
let record2 = {someData.Entry = "Lolo" ;someData.id =1224 }
datas.Add(record2)
let record3 = {someData.Entry = "Hihi" ;someData.id =1231 }
datas.Add(record3)
let nameOnly = new ResizeArray<string>()
for entries in datas do
nameOnly.Add(entries.Entry)