Integrate F # into an Existing .Net Application

I'm interested in using F #'s strengths in parallelism in an existing .Net application. That is, I would like to include the F # component, which will only handle the simultaneous transmission of messages from my application, leaving most of my existing .Net project as it is. An existing application will access the F # component.

1) Is this architecture appropriate? 2) If so, are there any examples demonstrating the best practice approach for this project?

Thank,

John

+3
source share
2 answers

1) Is this architecture appropriate?

This, of course, is not a bad approach :)

, , - ? , #.

2) , - , ?

F # # . , # dll F # , . , F #, #. funsies, , Reflector:

let f x y z = x(y z)
let (|A|B|C|) x =
    match x with
    | 1 -> A
    | 2 -> B
    | x -> C x
type whatever = X | Y | Z of int

FSharpFunc, , .. #, , , # , . :

module CSharpFacade =
    let f(x : System.Func<_, _>, y : System.Func<_, _>, z) = f (fun param -> x.Invoke(param)) (fun param -> y.Invoke(param)) z

    [<AbstractClass>]
    type Whatever() =
        inherit obj()
        abstract member Map : unit -> whatever
    type X() =
        inherit Whatever()
        override this.Map() = whatever.X
    type Y() =
        inherit Whatever()
        override this.Map() = whatever.Y
    type Z(value : int) =
        inherit Whatever()
        member this.Value = value
        override this.Map() = whatever.Z(value)

, , F # #. , , .

Some/None , , Option<someValueType> Nullable<someValueType> null None , , ..

+4

, , . . DLL, F #.

:

, , , , - VsVim. Vim Visual Studio, F # , # Visual Studio.

, F #, , # VB.Net. , .

+4

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


All Articles