Bagikan melalui


Core.ComparisonConditionalOnAttribute Class (F#)

Indicates that a generic type satisfies the comparison constraint if and only if the type argument satisfies this constraint.

Namespace/Module Path: Microsoft.FSharp.Core

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

[<AttributeUsage(16384, AllowMultiple = false)>]
[<Sealed>]
type ComparisonConditionalOnAttribute =
 class
  new ComparisonConditionalOnAttribute : unit -> ComparisonConditionalOnAttribute
 end

Remarks

This attribute is used to indicate a generic container type satisfies the F# comparison constraint only if a generic argument also satisfies this constraint. For example, adding this attribute to parameter 'T on a type definition C<'T> means that a type C<X> only supports comparison if the type X also supports comparison and all other conditions for C<X> to support comparison are also met. The type C<'T> can still be used with other type arguments, but a type such as C<(int -> int)> will not support comparison because the type (int -> int) is an F# function type and does not support comparison.

This attribute will be ignored if it is used on the generic parameters of functions or methods.

You can also use the short form of the name, ComparisonConditionalOn.

Constructors

Member

Description

new

Creates an instance of the attribute.

Platforms

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

Version Information

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

See Also

Reference

Microsoft.FSharp.Core Namespace (F#)