logo
  • 教程列表
  • SO官方文档
  • 日志
    • 将成员函数添加到记录中
    • 基本用法
  1. StackOverflow 文档
  2. F# 教程
  3. 日志
  4. 将成员函数添加到记录中

将成员函数添加到记录中

Created: November-22, 2018

type person = {Name: string; Age: int} with   // Defines person record
    member this.print() =
        printfn "%s, %i" this.Name this.Age

let user = {Name = "John Doe"; Age = 27} // creates a new person

user.print() // John Doe, 27
  • 基本用法
  • 日志

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明