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 4270600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:19:42+00:00 2026-05-21T07:19:42+00:00

Stumped with a OOP interface F# question. Example – when I create a class

  • 0

Stumped with a OOP interface F# question.

Example – when I create a class and try to implement a single method Run(string,string,string) from a Namespace Example from an Interface IRunner
I can see in .NET Reflector what really gets created is a private method named Example-IRunner-Run(string,string,string) If I then want to expose this back to a C# lib it presents an issue. Via reflection – code I’m not in control of is just looking for a class with a public Run method. How do I solve? Can’t seem to find any documentation on this.

Problem 1 – Run should be public some how ends up private
Problem 2 – the crazy long method name – instead of just Run

Not sure if I need to be using some modifier keywords or a signature file…. just not just where to start with the (1) private and (2) the strange method name (reflection won’t find)

note: in this example Run returns an int
In this current implementation I’m just trying to return a 1 to “proof of concept” that I can do this simple thing in F#

example code:

namespace MyRunnerLib

open Example

type MyRunner() = class
  interface IRunner with 
   member this.Run(s1, s2, s3) = 1
end
  • 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-05-21T07:19:43+00:00Added an answer on May 21, 2026 at 7:19 am

    Additionally, there are a few options how to write this. Robert’s version has the actual implementation in the additional member. If you place the implementation into the interface, you can avoid the casting.
    (Also note that you don’t need class .. end keywords):

    type MyRunner() = 
      member this.Run(a,b,c) = 1
      interface IRunner with 
        member this.Run(a,b,c) = this.Run(a,b,c)
    

    Slightly clearer way is to define the functionality as a local function and then just export it two times:

    type MyRunner() = 
      // Implement functionality as loal members
      let run (a, b, c) = 1
    
      // Export all functionality as interface & members
      member this.Run(a,b,c) = run (a, b, c)
      interface IRunner with 
        member this.Run(a,b,c) = run (a, b, c)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am completely stumped as to why this code does not get any SDL
I am completely stumped. I have a program that pulls information stored in a
I'm completely stumped on this one. I have three different lists that need to
This really has my stumped today. I'm sure its simple, but... Here is my
This one has me kind of stumped. I want to make the first word
I have this strange call stack and I am stumped to understand why. It
Finding a good way to do this has stumped me for a while now:
I don't know if anyone has seen this issue before but I'm just stumped.
I've never forked a project before so I'm a little stumped as to how
I'm currently writing an edit-in-place script for MooTools and I'm a little stumped as

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.