我正在从 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))>]
然后我得到:
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.
最佳答案
只写这个片段:
[<assembly: ...>]
do ()
关于xamarin.forms - 如何用 F# 声明 Xamarin.Forms.Dependency?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47106076/