我正在从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:此属性不适用于此语言 元素。程序集属性应附加到"do ()" 声明(如有必要,在 F# 模块中)。
只需编写此片段:
[<assembly: ...>]
do ()