Define op_Implicit, or op_Explicit, but not both. The diagnostic is bad here, but that's the problem. Comment either one out and it works.

By on 11/6/2010 1:12 PM ()

Hi,

the int conversion operator works with predefined primitive types, but the type you defined already supports conversion to int:

let x = EvenRoll 0

let x1 = x |> EvenRoll.op_Explicit

or:

let x2 = x.value

I Hope this is the answer you're looking for, regards Taha.

By on 11/6/2010 10:40 AM ()

Okay. But what's the point of defining op_Implicit or op_Explicit for a user type? Couldn't you just define any arbitrary member that does this, since you have to call it explicitly anyway?

By on 11/6/2010 10:48 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