Reputation: 3124
In C# you can write string.Join
and String.Join
. But in F# you cannot write string.Join but only String.Join. Why is that? Is not string a type alias over .NET String class?
Upvotes: 5
Views: 91
Reputation: 5005
In F# string
, depending on where it's used, is a type alias or a function:
string 12 // this stringifies '12'
let f (s: string) = ... // here 'string' is a type alias for 'System.String'
And so static members like Join
don't sit on string
. They are available via String
. If you created your own alias, then you'd get access to the static members via .
.
In C#, both string
and String
refer to the same System.String
at all times.
Upvotes: 11