Defining static classes in F#

后端 未结 5 722
故里飘歌
故里飘歌 2021-02-12 03:56

Is it possible to define a static class that contains overloadable members in F#? let module bindings cannot be overloaded, even though they are compiled into stati

5条回答
  •  星月不相逢
    2021-02-12 04:20

    I'm not sure there is such a thing as a static class. 'static' on class level in C# was introduced in 2.0, I believe, mostly as convenience (avoid private constructors and compile-time checking that no instance members are present). You can't examine the type and conclude that it is static: http://msdn.microsoft.com/en-us/library/system.reflection.typeinfo.aspx

    Update: MSDN declares a static class is a class that is sealed and has only static members: http://msdn.microsoft.com/en-us/library/79b3xss3(v=vs.80).aspx

    So, what you're doing at the moment is the way to do it.

提交回复
热议问题