Megosztás a következőn keresztül:


Collections.List<'T> Union (F#)

The type of immutable singly-linked lists.

Namespace/Module Path: Microsoft.FSharp.Collections

Assembly: FSharp.Core (in FSharp.Core.dll)

[<DefaultAugmentation(false)>]
[<StructuralEquality>]
[<StructuralComparison>]
type List<'T> =
| ( [] )
| ( :: ) of 'T * 'T list
 with
  interface IStructuralEquatable
  interface IComparable
  interface IComparable
  interface IStructuralComparable
  interface IEnumerable
  interface IEnumerable
  static member List.Cons : 'T * 'T list -> 'T list
  static member List.Empty :  'T list
  member this.Head :  'T
  member this.IsEmpty :  bool
  member this.Item (int) :  'T
  member this.Length :  int
  member this.Tail :  'T list
 end

Remarks

Use the constructors [] and :: (infix) to create values of this type, or the notation [1;2;3]. Use the values in the List module to manipulate values of this type, or pattern match against the values directly.

This type is named FSharpList in the .NET assembly. If accessing the type from a .NET language other than F#, or through reflection, use this name.

Instance Members

Member

Description

Head

Gets the first element of the list.

IsEmpty

Gets a value indicating if the list contains no entries.

Item

Gets the element of the list at the given position.

Length

Gets the number of items contained in the list.

Tail

Gets the tail of the list, which is a list containing all the elements of the list, excluding the first element.

Static Members

Member

Description

Cons

Returns a list with the first argument as its first element and the second argument as its subsequent elements.

Empty

Returns an empty list of a particular type.

Union Cases

Case

Description

( :: ) of 'T * 'T list

The cons operator.

( [] )

The empty list.

Platforms

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Reference

Microsoft.FSharp.Collections Namespace (F#)

Collections.List Module (F#)