3

我从 C# 移植这段代码:

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;
        }
    }
}

但是,这部分看不到如何在 F# 中编写它:

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

我尝试:

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

我得到:

错误 FS0841:此属性不适用于此语言元素。如有必要,应在 F# 模块中将程序集属性附加到“do ()”声明。

4

1 回答 1

1

只写这个片段:

[<assembly: ...>]
do ()
于 2017-11-04T19:39:04.947 回答