If you have a module in F#, with functions defined in it using let, these will be visible from C# as static members on a class with the same name as a module.

1
module MyMod =let myFunction() = true

is "compiled" as:

1
public class MyMod{public static void myFunction(){return true;}}

If by "dyanmically", you mean using reflection, than this should get you started as well: to find all functions in a module, find the type of the module-class, and use GetMethod/GetProperty to find the lets. (there are a few snags there, but that's the principle at least.)Kurt

By on 6/17/2009 11:33 PM ()

Hi thankyou for replies...

but that i dont want to do..

I have a number of scritps..

1.fsx

2.fsx

3.fsx

can i run then from my C# code..

something like ..

Call 1.fsx

call 2.fsx

I know i could do something like invoking the Fsi.exe with the filename ... but is there a cleaner way of doing so..

By on 6/18/2009 8:47 AM ()

Are you trying to use F# as a scripting language for you C# application? If that is the case then I think one way is to use the FSharp.CodeDom.Compiler to create a 'compiler()'. And then create an assembly in memory from source or file using that and then run the assembly.

This shows you how to do it with C#. The process in F# is exactly the same except that the CreateCompiler() will be from F#.

By on 6/18/2009 3:32 PM ()

I know i could do something like invoking the Fsi.exe with the filename ... but is there a cleaner way of doing so..

Don't think so.

By on 6/18/2009 11:02 AM ()

[link:blogs.msdn.com]

look at Luca's Speech. I'm looking into this too in some weeks from now, since most of my program's will remain in C#.

I don't mind seeing some code appearing here to though, but Luca showed the principle.

By on 6/17/2009 10:57 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