F# 为什么这两个都编译,但只有一个运行?

F# 为什么这两个都编译,但只有一个运行?,f#,com,delegates,F#,Com,Delegates,为什么两者都编译,但其中一个给出了一个异常 (IntPtr*IntPtr)->bool的委托与IntPtr*IntPtr->bool的委托有何不同? 他们不应该是同一件事吗?(IntPtr*IntPtr)与IntPtr*IntPtr不一样吗? open System open System.Diagnostics open System.Runtime.InteropServices module PInvoke = type EnumThreadDelegate= delegate

为什么两者都编译,但其中一个给出了一个异常

(IntPtr*IntPtr)->bool的
委托与IntPtr*IntPtr->bool的
委托有何不同?
他们不应该是同一件事吗?
(IntPtr*IntPtr)
IntPtr*IntPtr
不一样吗?

open System
open System.Diagnostics
open System.Runtime.InteropServices
module PInvoke = 
    type EnumThreadDelegate= delegate of IntPtr * IntPtr -> bool
    type ComArrayList() =
        inherit System.Collections.ArrayList() 

    [<DllImport("user32.dll")>]
    extern [<return: MarshalAs(UnmanagedType.Bool)>] bool private EnumThreadWindows(int dwThreadId, EnumThreadDelegate lpfn, IntPtr lParam);
    let getThreadWindows (threadId:int) : _ list = 
        let items = ResizeArray()
        let withData (hWnd:IntPtr) (lParam:IntPtr) = 
            let _ = items.Add(hWnd,lParam)
            true
        let f = EnumThreadDelegate withData

        EnumThreadWindows (threadId, f, IntPtr.Zero) |> ignore<bool>
        items
        |> Seq.cast<IntPtr*IntPtr>
        |> List.ofSeq


let lp = Process.GetProcesses() |> Seq.filter(fun p -> p.ProcessName.StartsWith("L")) |> Seq.minBy(fun p -> p.StartTime) 
lp.Threads
|> Seq.cast<ProcessThread> 
|> Seq.map (fun t -> t.Id) 
|> Seq.map PInvoke.getThreadWindows
|> List.ofSeq
是一个单参数委托,它接受一个
元组
,而

delegate of (IntPtr*IntPtr) -> bool
是一个双参数委托,它将两个
IntPtr
s作为其两个参数

delegate of (IntPtr*IntPtr) -> bool
delegate of IntPtr*IntPtr -> bool