Table of contents
TOC
Collapse the table of content
Expand the table of content

Core.CompilationRepresentationFlags Enumeration (F#)

Den Delimarsky|Last Updated: 7/4/2016
|
2 Contributors

Indicates one or more adjustments to the compiled representation of an F# type or member.

Namespace/Module Path: Microsoft.FSharp.Core

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

Syntax

[<Flags>]
type CompilationRepresentationFlags =
| None = 0
| Static = 1
| Instance = 2
| ModuleSuffix = 4
| UseNullAsTrueValue = 8
| Event

Remarks

The following table shows the possible values and their meaning.

ValueDescription
NoneNo special compilation representation.
StaticCompile an instance member as static.
InstanceCompile a member as instance even if null is used as a representation for this type.
ModuleSuffixAppend Module to the end of a module whose name clashes with a type name in the same namespace.
UseNullAsTrueValuePermit the use of null as a representation for nullary discriminators in a discriminated union.
EventCompile a property as a Common Language Infrastructure (CLI) event.

This enumeration is often used with the CompilationRepresentationAttribute:

[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Foo

F# modules are compiled as static classes, but this can sometimes cause naming conflicts with namespaces. In the above example, you may wish to also have a namespace named Foo, but you can't have both. Using ModuleSuffix instructs the compiler that the Foo module should be compiled to a class called FooModule. Other F# code will still refer to the Foo module, but from C# or Visual Basic .NET, the name of the class will be visible as FooModule.

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

CompilationRepresentationAttributeMicrosoft.FSharp.Core Namespace (F#)

© 2016 Microsoft