How declare Xamarin.Forms.Dependency with F#?

136 Views Asked by At

I'm porting from C# this code:

using MicroBlink;

[assembly: Xamarin.Forms.Dependency (typeof (BlinkIDImplementation))]
namespace BlinkIDApp.iOS
{
    public class BlinkIDImplementation : IBlinkID
    {
        CustomDelegate customDelegate;
        bool isFrontCamera;

        public BlinkIDImplementation ()
        {
            customDelegate = new CustomDelegate ();

            BlinkID.Instance ().LicenseKey = "MZEFTUGV-******";
            BlinkID.Instance ().Delegate = customDelegate;
            isFrontCamera = false;
        }
    }
}

But then, this part can't see how write it in F#:

[assembly: Xamarin.Forms.Dependency (typeof (BlinkIDImplementation))]

I try:

[<assembly: Xamarin.Forms.Dependency (typeof (BlinkIDImplementation))>]

And I get:

Error FS0841: This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module.

1

There are 1 best solutions below

4
Igor Bespalchuk On

Just write this fragment:

[<assembly: ...>]
do ()

Related Questions in F#