F#,我为什么不能访问"项目"会员 [英] F#, why can't I access the "Item" member

查看:99
本文介绍了F#,我为什么不能访问"项目"会员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在F#中,我为什么不能访问项目成员阵列的位置:

 让最后一个(ARR:System.Array的)=
    让楞= arr.Length
    ARR [楞-1] //错误:字段,构造函数或成员项没有定义。


解决方案

你可以试试这个?

 让最后一个(ARR:_ [])=
       让楞= arr.Length
       编曲。[楞1]

In F#, why can't I access the "Item" member on the Array here:

let last (arr:System.Array) =
    let leng = arr.Length
    arr.[leng-1]   // Error: Field, constructor or member "Item" is not defined.

解决方案

Can you try this?

let last (arr:_[]) =
       let leng = arr.Length
       arr.[leng-1]

这篇关于F#,我为什么不能访问"项目"会员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆