我在模块中定义了一个类型,并尝试创建该类型的记录。
namespace ClassLibrary1
module Data =
type Location = {Latitude: double; Longitude: double}
在我的测试方法中
namespace TestProject2
open System
open Microsoft.VisualStudio.TestTools.UnitTesting
open ClassLibrary1
open Data
[<TestClass>]
type TestClass () =
[<TestMethod>]
member this.TestMethod3 () =
let location = {Latitude=40.0; Longitude=40.1}
// Console.WriteLine location
错误
在类型定义中,
let和do绑定必须位于成员和接口定义之前。
发布于 2019-04-28 08:53:46
但事实证明,这是从嵌套类型定义记录的方法,希望有人能阐明这一点,找到更好的方法等等。
let location = {Data.Latitude=40.0; Data.Longitude=40.1}
https://stackoverflow.com/questions/55885572
复制相似问题