F#:为什么需要这些括号(语法)

标签 f#

只是为了让我自己安心,我想知道为什么在我的 AssemblyInfo.fs 文件的最后一行中,有必要添加一个 ()命令它编译。你怎么称呼这个语法?

namespace TestComComponentFSharp

open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices

[<assembly: AssemblyTitle("TestComComponentFSharp")>]
[<assembly: ComVisible(true)>]
[<assembly: Guid("0B684F15-DC37-40C0-A785-EDF1A63BBAF5")>]
[<assembly: AssemblyKeyFile("KeyFile.snk")>]

[<assembly: AssemblyVersion("1.0.0.0")>]
[<assembly: AssemblyFileVersion("1.0.0.0")>]

()

最佳答案

您需要一些东西来应用这些程序集属性。这就是empty()或do()的用途。它称为“空表达式” - 它返回一个单位。

关于F#:为什么需要这些括号(语法),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30525731/

相关文章:

c# - 如何在C#中改进推送数据管道以使其性能与F#相匹配

f# - Series.hasNot 中有错误吗?

c# - F# Data CsvProvider 从 C# 应用程序 Interop 使用

具有多态(在 OO 意义上)返回类型的 F# 函数

f# - 从字符串创建可区分联合大小写

F# 转换为文字运行时提供的类型

compiler-errors - 错误: Type constraint mismatch when applying the default type 'int * int' for a type inference variable [duplicate]

.net - 为什么 F# 不支持使用类型缩写扩展系统类型?

F#,主格或结构类型

.net - 如何在 F# 中为 .NET 函数命名