Let say I have this interface in C# and want to implement it in F#
public interface IBatch
{
System.Data.IDbConnection Connection { get; set; }
}
I wish to implement the interface in F# but cant figure out the correct syntax. I have something like this:
type public Batch =
interface IBatch with
member f.Connection
with get() = new Devart.Data.Oracle.OracleConnection()
and set value = ()
The error I'm getting is:
This expression was expected to have type IDbConnection but here has type Devart.Data.Oracle.OracleConnection
F# does not implement implicit downcasting like C# does, you need to have
type public Batch =
interface IBatch with
member f.Connection
with get() = new Devart.Data.Oracle.OracleConnection() :> System.Data.IDbConnection
and set value = ()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With