Overload operator in F#
- by forki23
Hi,
I would like to overload the (/) operator in F# for strings and preserve the meaning for numbers.
/// Combines to path strings
let (/) path1 path2 = Path.Combine(path1,path2)
let x = 3 / 4 // doesn't compile
If I try the following I get "Warning 29 Extension members cannot provide operator overloads. Consider defining the operator as part of the type definition instead."
/// Combines to path strings
type System.String with
static member (/) (path1,path2) = Path.Combine(path1,path2)
Any ideas?
Regards,
forki