Under one unified cast syntax C# mixes two conceptually different conversion types:

  • Conversions that doesn't change representation: i.e. reference conversions
  • Conversions that changes representation: these operations convert source data to another object (like in your case)

F# behavior is different, it separates these operations and use different syntax .
You need to invoke conversion operator explicitly:

1
2
3
4
5
6
7
8
let p = Point(1,2)
// explicit call
let pf = Point.op_Implicit p

// IMO more convinient way
let pointF = Point.op_Implicit
let pf2 = pointF p
By on 9/8/2010 11:45 PM ()

thank you! i got it

By on 9/9/2010 4:34 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