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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:05:40+00:00 2026-05-15T02:05:40+00:00

incorporating leppies feedback it compiles – but IMO some drawbacks I want each sub

  • 0

incorporating leppies feedback it compiles – but IMO some drawbacks I want each sub class to be forced by the compiler to define their own Uri property. Code as it is now:

[<AbstractClass>] 
type UriUserControl() = 
    inherit UserControl()
    interface IUriProvider with 
        member this.Uri with get() = null

Interesting enough, the class I defines which inerits from above does not show a public Uri property:

type Page2() as this =
    inherit UriUserControl()
    let uriStr = "/FSSilverlightApp;component/Page2.xaml"
    let mutable uri = new System.Uri(uriStr, System.UriKind.Relative)
    do
        Application.LoadComponent(this, uri)

    member public this.Uri with get () = uri

I would like to define an abstract class that inherits from UserControl and my own Interface IUriProvider, but doesn’t implement it. The goal is to be able to define pages (for silverlight) that implement UserControl but also provide their own Uri’s (and then stick them in a list / array and deal with them as a set:

type IUriProvider = 
interface
    abstract member uriString: String ;
    abstract member Uri : unit -> System.Uri ;
end

[<AbstractClass>] 
type UriUserControl() as this = 
    inherit IUriProvider with
        abstract member uriString: String ;
    inherit UserControl()

Also the Uri in the definition – I would like to implement as a property getter – and am having issues with that as well.

this does not compile

type IUriProvider = 
    interface
        abstract member uriString: String with get;
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-15T02:05:41+00:00Added an answer on May 15, 2026 at 2:05 am

    Here is a way to do it:

    type IUriProvider =  
        abstract member UriString: string
        abstract member Uri : System.Uri
    
    [<AbstractClass>]  
    type UriUserControl() as this =  
        inherit System.Windows.Controls.UserControl() 
        abstract member Uri : System.Uri
        abstract member UriString : string
        interface IUriProvider with 
            member x.Uri = this.Uri
            member x.UriString = this.UriString
    

    Note that you have to provide an implementation of the interface (since all interface implementations in F# are explicit), but this can just refer back to abstract members in the class. Then you can subclass thusly:

    type ConcreteUriUserControl() =
        inherit UriUserControl()
        override this.Uri = null
        override this.UriString = "foo"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to start incorporating LABjs into my project but I want to
I am attempting to write a two-pass algorithm incorporating some legacy code. I want
I've quickly made up a sliding doors example but I'm incorporating it into my
Can some one please highlight what should be the process of incorporating reusable django
I'm incorporating a GWT application in my website and I need to execute some
I am currently taking a class which is incorporating a topic I have not
I'm scripting some data transfer routines and incorporating exp and imp into the workflow.
Im incorporating the facebook SDK into an update and i get compiler warnings for
I am incorporating some C code in my objective-C project. My break point is
I am currently learning PHP and I want to start incorporating Facebook basic elements

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.