Super simple question I'm sure but I don't do F# usually so a bit new to the syntax.
How do I read the following fragment of code:
match shape.Fill with
| :? PictureBrush as pb ->
//....
Specifically, I'm not sure what PictureBrush
refers to. There's not really any reference to it anywhere else in this file
This the Type Test Pattern.
PictureBrush
is a type. shape.Fill
matches :? PictureBrush
when the Fill
property is assignable to that type.
Also note that the as
allows for binding of a variable to be of that type. So pb
will be of type PictureBrush
, but will have the exact same value as what shape.Fill
resolved to.
Its a type comparison. Like typeof(xx) in C#. So match to type of PictureBrush.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With