types - F# equivalent of `is` keyword in C#? -
my first f# day. if have this:
let cat = animal()
now how check @ later stage if cat
is
animal
?
in c#
bool b = cat animal;
in f#?
@ildjarn deserves credit here answering first, i'm submitting answer here can accepted.
the f# equivalent of c# is
keyword :?
. example:
let cat = animal() if cat :? animal printfn "cat animal." else printfn "cat not animal."
Comments
Post a Comment