Implicit conversion from char to char [] in F #?

Why does String.Split accept char even though it requires char []

let c = '.' // char
"aa.bb".Split(c) // works! although Split requires char[]

      

The implicit type conversion from char to char [] does not explain this, as it shows:

let f (cs : char[]) = ()

f('a') // error: expected char[]

      

+3


source to share


1 answer


String.Split

does not take as an argument char[]

. It actually takes params char[]

. As a result, the compiler does some magic and the call is only possible with one char

.



+3


source







All Articles