Getting started
Installing the package
To install the latest version of FSharpWrap using the .NET CLI, use the following:
1:
|
|
Using generated code
In order to use the generated code in your project, add the following element
to your project file in an <ItemGroup>
above all other <Compile>
items:
1:
|
|
Because the generated code is quite large by default, the following should also
be added to a .gitignore
file:
1:
|
|
Any instance methods, constructors, instance read-only fields, and get-only properties on classes and immutable structs will then have F# functions, active patterns, or computation expressions generated for them.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: |
|
|
Filtering generated code
FSharpWrap allows entire assemblies and namespaces to be included or excluded from code generation, which helps reduce compilation times by generating only code that you will use. Note that assemblies can only either be included or excluded, and that namespaces can only either be included or excluded.
To only include certain assemblies in code generation, use the following:
1: 2: 3: 4: |
|
To only exclude certain assemblies from code generation, use the following:
1: 2: 3: |
|
Following the inclusion or exclusion of assemblies, FSharpWrap will also include or exclude any specified namespaces. Note that in order to include or exclude any "child" namespaces, their names must be specified as well.
To only include the types in certain namespaces, use the following:
1: 2: 3: |
|
To only exclude types in certain namespaces, use the following:
1: 2: 3: 4: |
|
Code Generation Limitations
Only public members are included in code generation.
Currently, any non-readonly structs (structs not marked
IsReadOnly
in F#)
are excluded from code generation.
type Stack<'T> =
new : unit -> Stack<'T> + 2 overloads
member Clear : unit -> unit
member Contains : item:'T -> bool
member CopyTo : array:'T[] * arrayIndex:int -> unit
member Count : int
member GetEnumerator : unit -> Enumerator<'T>
member Peek : unit -> 'T
member Pop : unit -> 'T
member Push : item:'T -> unit
member ToArray : unit -> 'T[]
...
nested type Enumerator
--------------------
Stack() : Stack<'T>
Stack(capacity: int) : Stack<'T>
Stack(collection: IEnumerable<'T>) : Stack<'T>
val int : value:'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
val string : value:'T -> string
--------------------
type string = System.String
type ImmutableList =
static member Create<'T> : unit -> ImmutableList<'T> + 2 overloads
static member CreateBuilder<'T> : unit -> Builder<'T>
static member CreateRange<'T> : items:IEnumerable<'T> -> ImmutableList<'T>
static member IndexOf<'T> : list:IImmutableList<'T> * item:'T -> int + 3 overloads
static member LastIndexOf<'T> : list:IImmutableList<'T> * item:'T -> int + 3 overloads
static member Remove<'T> : list:IImmutableList<'T> * value:'T -> IImmutableList<'T>
static member RemoveRange<'T> : list:IImmutableList<'T> * items:IEnumerable<'T> -> IImmutableList<'T>
static member Replace<'T> : list:IImmutableList<'T> * oldValue:'T * newValue:'T -> IImmutableList<'T>
static member ToImmutableList<'TSource> : source:IEnumerable<'TSource> -> ImmutableList<'TSource> + 1 overload
--------------------
type ImmutableList<'T> =
member Add : value:'T -> ImmutableList<'T>
member AddRange : items:IEnumerable<'T> -> ImmutableList<'T>
member BinarySearch : item:'T -> int + 2 overloads
member Clear : unit -> ImmutableList<'T>
member Contains : value:'T -> bool
member ConvertAll<'TOutput> : converter:Func<'T, 'TOutput> -> ImmutableList<'TOutput>
member CopyTo : array:'T[] -> unit + 2 overloads
member Count : int
member Exists : match:Predicate<'T> -> bool
member Find : match:Predicate<'T> -> 'T
...
nested type Builder
nested type Enumerator
val seq : sequence:seq<'T> -> seq<'T>
--------------------
type seq<'T> = IEnumerable<'T>