0
好吧,这让我很生气。这个代码怎么可能不起作用?字典没有找到在使用F时放入的键#
open System.Collections.Generic
type testing (a:int)=
let test = [Empty]
member p.GetHashCode =
fun() -> printfn "called hash";0
override p.Equals(other:obj) =
printfn "called equals"
true
interface IEquatable<testing> with
override p.Equals(other:testing) =
true
static member op_Equality (other:obj) = printfn "called op" ;true
let dict2 = new Dictionary<testing,int>()
dict2.[(testing 50)] <- 50
dict2.[(testing 50)]
当试图从字典中提取并且不调用任何提供的方法时,代码片段就会死亡。我今天只是疯了,还是有什么不对?
男人,你是对的。我已经把我的头撞在墙上两个小时了,很多。不能看到,我没有看到 – LDomagala 2009-06-17 11:24:33