Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:43:56+00:00 2026-06-14T11:43:56+00:00

Is it possible to define a static class that contains overloadable members in F#?

  • 0

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 static members in static classes.

type declarations can contain static members, but I don’t know if the type itself can be made static.

My current solution is to define a type with a private constructor and just use that. I’m wondering if there is a way I can define a static type as I want.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:43:57+00:00Added an answer on June 14, 2026 at 11:43 am

    As Robert Jeppeson pointed out, a “static class” in C# is just short-hand for making a class that cannot be instantiated or inherited from, and has only static members. Here’s how you can accomplish exactly that in F#:

    [<AbstractClass; Sealed>]
    type MyStaticClass private () =
        static member SomeStaticMethod(a, b, c) =
           (a + b + c)
    
        static member SomeStaticMethod(a, b, c, d) =
           (a + b + c + d)
    

    This might be a little bit of overkill, as both the AbstractClass and the private constructor will prevent you from creating an instance of the class, however, this is what C# static classes do – they are compiled to an abstract class with a private constructor. The Sealed attribute prevents you from inheriting from this class.

    This technique won’t cause a compiler error if you add instance methods the way it would in C#, but from a caller’s point of view there is no difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that it's possible to define a static class method as private and
As we know,It is possible to initialize integral const static members inside the class
Is it possible in Java to create a static factory method/class that uses an
Possible Duplicate: Conditional “Browsable” Attribute I define AppSettings class that have a few properties.
Possible Duplicate: Static members class vs. normal c-like interface I am looking at somebodies
Can I define multiple static blocks? If possible, why should I define muliple static
Possible Duplicate: Define a method that has many (or infinite) arguments I have the
I want to define a base class that defines a main method that instantiates
Let's suppose I define a domain class named Client in several datasources and create
Possible Duplicate Why can't I have a non-integral static const member in a class?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.