F # - What is an array <'T>?

In this previous question, I found out that in F # a array<'T> does not match System.Array .

VS tells me that array<'T> inherits from System.Array and has the full name Microsoft.FSharp.Core.array<_> and some additional interfaces.

However, MSDN says that array<'T> is an abbreviation of type System.Array . And that it has the designation arr.[i] for receiving and setting elements.

So, for my lesson, is there an array<'T> type abbreviation that includes type extensions and additional interfaces? Where is the best place to see it?

+6
source share
1 answer

The type array<'T> is an abbreviation, but not for the base type System.Array , but for another typical type that represents arrays in F #, which is written as 'T[] .

It means that

  • System.Array is a non-core base type (where you cannot use indexing and you can only get elements as objects)

  • 'T[] and array<'T> mean the same thing. This is a generic type that supports indexing, and you get 'T values ​​from it.

+10
source

Source: https://habr.com/ru/post/946761/


All Articles