在F#中是否有Dictionary类"System.Collections.Generic.Dictionary"的缩写/替代名称?
例如,C#List类型"System.Collections.Generic.List"在F#中有一个名为"ResizeArray"的缩写.
所以,如果我在F#中使用C#列表,我可以使用"ResizeArray",而不是在我的文件开头使用"open System.Collections.Generic"(因为这会导致C#List模块和F#List模块,例如,请参阅上面链接的Microsoft网页上的代码示例)
F#中有一个关键字是"System.Collections.Generic.Dictionary"的缩写吗?这样我就不需要使用"open System.Collections.Generic"并导致C#List和F#List之间发生潜在冲突.
非常感谢你.
小智 6
F#独立支持类型缩写. https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/type-abbreviations
type type-abbreviation = type-name
Run Code Online (Sandbox Code Playgroud)
所以你可以自己缩写字典类型:
type ResizeDictionary<'a,'b> = System.Collections.Generic.Dictionary<'a,'b>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
110 次 |
| 最近记录: |