Why do 2 delegate instances return the same hashcode?

前端 未结 4 476
眼角桃花
眼角桃花 2021-01-31 16:55

Take the following:

  var x =  new Action(() => { Console.Write(\"\") ; });
  var y = new Action(() => { });
  var a = x.GetHashCode();
  var b = y.GetHash         


        
4条回答
  •  再見小時候
    2021-01-31 16:55

    This smells like some of the cases mentioned in this thread, maybe it will give you some pointers on this behaviour. else, you could log it there :-)

    What's the strangest corner case you've seen in C# or .NET?

    Rgds GJ

提交回复
热议问题