Hi Dave,
With F# you would could use the new async stuff without bothering with
Rx, since F# events are first-class types that implement IObservable,
and implementing an interface in-line is so easy.
I've made some samples of how to make Async and event-streaming Excel
UDFs with F# - see
http://excel-dna.net/2013/03/26/async-and-event-streaming-excel-udfs-with-f/.
For the object handler you might just have a different implementation
of IExcelObservable.Subscribe - instead of the cancellation semantics
in my example you do removal from the dictionary.
Regards,
Govert
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
Ensure that the Excel-DNA project continues by
making your donation -
http://excel-dna.net/support/
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
On May 15, 5:02 am, DC <
da...@minnesotacarlson.com> wrote:
> Here's a quick example that is based on your C# example that uses a
> reference to my object handler class in F# (the updated version of the 2nd
> link in ngm's reply. I'm a little behind the times... I'm using a static
> RTD implementation (shamelessly based on one of Govert's previous posts
> with input from ngm) and have not moved to a reactive extentions based
> approach. The implementation is a bit cleaner in F# using inline
> functions, reflection, and generic functions in my opinion (go go type
> inference).
>
> My C# is not strong enough to know how to port my work back to C# from F#,
> but I was able to get the C# snippet below to work by just adding a
> reference to my F# solution.
>
> The F# example can be found at :
https://github.com/mndrake/ExcelObjectHandler
>
> Regards,
>
> Dave
>
> using System;using System.Collections.Generic;using System.Linq;using System.Text;using Utility;using ExcelDna.Integration;
> namespace Test
> {
> public class Dog
> {
> public Dog(string name)
> {
> Name = name;
> }
>
> public readonly string Name;
> }
>
> public class TestClass
> {
> [ExcelFunction]
> public static object CreateDog(string name)
> {
> return XlCache.register("Dog", new Dog(name));
> }
>
> [ExcelFunction]
> public static string GetName(string dogHandle)
> {
> Dog dog = XlCache.lookup<Dog>(dogHandle);
> return dog.Name;
> }
> }
>
>
>
>
>
>
>
> }