问题描述
在此我学会了在F#的阵列<'T>
是不一样的的System.Array
In this previous question I learnt that in F# an array<'T>
is not the same as System.Array
.
VS告诉我,阵列&LT;'T&GT;
继承的System.Array
并拥有全名 Microsoft.FSharp.Core.array&LT; _&GT;
和一些额外的接口
VS tells me that array<'T>
inherits System.Array
and has the full name Microsoft.FSharp.Core.array<_>
and some additional Interfaces.
不过说,阵列&LT; T&GT;
是的System.Array
的类型缩写。并且它具有符号编曲。[I]
来获取和设置项目。
However MSDN says that array<'T>
is a type abbreviation of System.Array
. And that it has the notation arr.[i]
to get and set items.
因此,对于我的教训,为阵列&LT;'T&GT;
A型的缩写,包括类型扩展更多的接口?哪里是看这件事最好的地方?
So for my lesson, is array<'T>
a type abbreviation that includes type extensions and additional Interfaces? Where is the best place to look this up ?
推荐答案
类型阵列&LT;'T&GT;
是一个缩写,但不是为盐基型的的System.Array
但是对于重新presents阵列F#中的另一个泛型类型,它写成'T []
。
The type array<'T>
is an abbreviation, but not for the base type System.Array
but for another generic type that represents arrays in F#, which is written as 'T[]
.
这意味着
-
的System.Array
是非通用基本类型(在这里你不能使用索引,你只能得到元素为对象)
System.Array
is the non-generic base type (where you cannot use indexing and you can only get elements as objects)
'T []
和阵列&LT;'T&GT;
意思完全一样的东西。他们是支持索引泛型类型,你从它那里得到'T
值。
'T[]
and array<'T>
mean exactly the same thing. They are the generic type which supports indexing and you get 'T
values from it.
这篇关于F# - 什么是数组&LT;'T&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!