F # does not allow you to silently ignore returned values. The unit type is the version of F # void . So the error says it all
I expected the operator to have no return, but instead it will return an int value
Or vice versa. I am not reading this error message correctly.
This is most likely one of the following
- This method expects an
int return value, but the Add method returns void, so F # just asks for the return value - This method is introduced as
unit , but Add returns int , and F # needs to ignore the value. - The return values of
GetCapture or ToWpfImage that must be explicitly processed.
In the last two cases, you can fix this by passing the value of the ignore function
mtvCap.GetCapture() |> ignore mtvCap.ToWpfImage() |> ignore grid.Children.Add(mtvCap.ImageElement) |> ignore
After digging around the bits, I believe problem # 2 is the problem, because UIElementCollection.Add returns an int value. Try changing the final line to look like this:
grid.Children.Add(mtvCap.ImageElement) |> ignore
Jaredpar
source share