21

in C# I could use the keyword 'is'

if (variable is string)
{
}

how is this done in f#

4

1 回答 1

34

尝试

if (variable :? string) ...

或者

let x = variable :? string
于 2013-08-23T21:21:50.887 回答