You can only use the "with" keyword with record types that are defined in F#, it doesn't work for types that are defined in other CLR languages. So yes "let d = System.DateTime(d.Year, d.Month, d.Day, 8, 0, 0)" is the only way to go for System.DateTime.

Cheers,
Rob

By on 10/4/2008 11:56 PM ()

Only tangentially related to your question, but you can always use named arguments in F#:

1
2
let d = new DateTime(year=5,month=5,day=5);

Just use the name of the formal argument.

That doesn't solve your problem, but imo it often makes heavily overloaded members better readable (like the DateTime constructor and its 12 overloads)

Just thought I'd mention it, it's a nice but lesser known feature I think.

Kurt

By on 10/5/2008 8:58 AM ()

Kurt, thank you. i think that style of declaration is much better.

By on 10/6/2008 8:22 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