Last active
December 18, 2015 04:29
-
-
Save blair55/5725824 to your computer and use it in GitHub Desktop.
Implement a C# Interface in F#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Domain | |
{ | |
public interface IMyInterface | |
{ | |
string MyProperty { get; set; } | |
void PerformAction(); | |
decimal MethodWithParameters(decimal a, int b); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Functional | |
open Domain | |
module MyModule = | |
type MyImplementation() = | |
let mutable TheVal = "" | |
let DoFunction = | |
printfn "hello" | |
() | |
let DivideValues a b = | |
a / decimal b | |
interface IMyInterface with | |
member this.MyProperty with get() = TheVal | |
member this.MyProperty with set(value:string) = TheVal <- value | |
member this.PerformAction() = DoFunction | |
member this.MethodWithParameters (a, b) = | |
DivideValues (a:decimal) (b:int) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment