F#'s classes, the types from your example above, do not support copy, you would need to implement this yourself by copying all thier fields.

F#'s record types support copy and changing by the keyword "with", i.e.

1
2
3
4
5
6
let person =
    { FirstName: string;
      LastName: string; }

let rob = { FirstName = "Robert"; LastName = "Pickering" }
let married = { rob with LastName = "Townson" }

Since equality is by structual comparison (two records with the same content are equal) there's no really need to copy records if you don't indent to make a change.

Cheers,
Rob

By on 1/22/2010 4:45 AM ()

Ok,I got it, thx for your answer.

By on 1/22/2010 9:55 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