If you'll be doing a bit of this, consider not having union types on the API boundary. (See the F# Component Design Guidelines:

[link:research.microsoft.com] )

By on 12/15/2010 9:05 AM ()

Brian

I am not planning on making a habit out of this but now that you pointed this design guideline out, can you suggest a different way to access the union values from C# instead of getting to them directly?

By on 12/15/2010 9:16 AM ()

Wrap it in an API of some sort (the design guidelines doc has a (very short) example). Depending on how the client code will consume it, the API may take various forms.

By on 12/15/2010 9:27 AM ()

See section 8.5.3 of the spec - you'll want to downcast to the discriminatedUnionType.StringValue nested type and use the Item property.

By on 12/15/2010 8:54 AM ()

Awesome! Thanks!

By on 12/15/2010 9:11 AM ()
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