.NET: Is Type.GetHashCode guaranteed to be unique?

前端 未结 3 698
离开以前
离开以前 2021-01-17 17:56

I have someone using Type.GetHashCode as if it were a primary key. I think this is a horrible idea but I wanted to know if there was some sort of documented special case tha

3条回答
  •  滥情空心
    2021-01-17 18:33

    It's not guaranteed to be unique.

    If your assemblies are strongly named you could use the fully qualified type name as a unique key to identify a Type.

提交回复
热议问题