问题描述
我对F#非常陌生,我开始在OpenGL之上编写函数包装.我还打算用它来编写一个图形引擎,该引擎应与所有.Net语言互操作.
I am very new to F# and I started to write my functional wrapper on top of OpenGL. I also intend to use it to write a graphics engine which should have interop with all .Net languages.
但是很难找到有关F#中的哪些代码构造不符合CLS的信息.
But it is hard to find information about which code constructs in F# are not CLS compliant.
例如,我已经知道一些不符合CLS的内容:
For example I already know of a few that are not CLS compliant:
- 静态类型约束
- 无元函数
- 可能
'T list and Seq
- 甚至工会类型
- static type constrains
- tupleless functions
- probably
'T list and Seq
- maybe even union types
我怎么知道F#的哪些功能不符合CLS?
How do I know what features of F# are not CLS compliant?
推荐答案
使用 CLSCompliant属性.它将确保您的代码在编译时符合CLS.
Use the CLSCompliant attribute. It will guarantee that your code is CLS-Compliant at compile time.
赞:
module myProject.AssemblyInfo
open System
[<assembly: CLSCompliant(true)>]
do()
有关CLSCompliant属性的更完整讨论,请参见 C#Corner:使您的代码符合CLS
For a more complete discussion of the CLSCompliant attribute, see C# Corner: Making Your Code CLS Compliant
这篇关于在F#中编写符合CLS的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!