F # - which corresponds to ... with | :? X how does x mean?

Super easy question. I'm sure, but I do not do F #, usually so little new for syntax.

How to read the following code snippet:

        match shape.Fill with
          | :? PictureBrush as pb ->
              //....

In particular, I'm not sure what it refers to PictureBrush. There is no link to it anywhere in this file.

+5
source share
3 answers

This type of test pattern .

PictureBrushis a type. shape.Fillmatches :? PictureBrushwhen a property is Fillassigned to this type.

+8
source

Also note that asit allows you to bind a variable to this type. Thus, it pbwill be of type PictureBrush, but will have the same meaning as for shape.Fill.

+2

. typeof (xx) #. PictureBrush.

+1

All Articles