This is a tough one. Intuition tells me that F# is not going to do this at all (it does not use, and probably does not recognize the "protected" modifier), but you should really look it up in the language spec to know for sure.

By on 4/1/2013 5:45 AM ()

From the research I've done so far, it seems you are correct. However, good tip for checking the language spec itself, which I haven't done yet. Will do that too. Thanks!

By on 4/6/2013 5:58 AM ()

I guess you will have to resort to doing it by reflection, something like this?:

1
2
3
4
5
typeof<WeakEventManager>
    .GetNestedType("ListenerList", System.Reflection.BindingFlags.NonPublic)
    .GetConstructors()
|> Seq.head
|> fun ctor -> ctor.Invoke [||]

Simpler still

1
2
typeof<WeakEventManager>.GetNestedType("ListenerList", System.Reflection.BindingFlags.NonPublic)
|> System.Activator.CreateInstance
By on 4/8/2013 2:21 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper