Micha
Micha

Reputation: 69

F# function parameters

I have 2 lines of code here:

let stuff _ _ = MessageBox.Show("This is doing stuff") |> ignore
let stuffHandler = new EventHandler(stuff)

I just started with F# and would like to know why the code does not compile if I remove underscores from stuff variable? As far as I know underscore means to ignore something so what should be ignored here?

Upvotes: 3

Views: 254

Answers (1)

Phillip Trelford
Phillip Trelford

Reputation: 6543

The EventHandler delegate expects a function with 2 parameters, the sender and the EventArgs.

Upvotes: 6

Related Questions