目前我有一段用C#编写的代码,它被一段F#代码用作.NET库.这是问题:
假设我在C#库中有以下类:
namespace Jaxrtech.Logic
{
public class Initializer
{
public Initializer()
{
}
public async Task Setup()
{
// Run implementation independed setup here
// Now call the implementation specific override
await OnSetup();
// Do any additional setup after the implemntation specific stuff
}
// Allow for custom setup tasks to be ran by the Initializer
protected virtual async Task OnSetup()
{
// Return a completed task by default
await Task.FromResult(0);
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后在F#中覆盖,如下:
open System.Threading.Tasks
open Jaxrtech.Logic
type …Run Code Online (Sandbox Code Playgroud)