开发者

hashTable "properties" C#

开发者 https://www.devze.com 2023-02-04 06:24 出处:网络
is someone know what is the hash function that the hashtable use in C#? what is the size of the table? is it proportional to the data i\'ll insert (e.g 30% more then my data)? or it\'s a fixed size?
  1. is someone know what is the hash function that the hashtable use in C#?

  2. what is the size of the table? is it proportional to the data i'll insert (e.g 30% more then my data)? or it's a fixed size?

  3. can i do the hashTable in one type, like string, or it's alwways return and get an object t开发者_运维知识库ype? i don't want to do casting every time i get a data from the table....


Start by reading the Remarks section of the Hashtable documentation. If you do not find enough details about the implementation you can use .NET Reflector. To have a hashtable with specific key and value types, you should use System.Collections.Generic.Dictionary<TKey, TValue>.


  1. Object.GetHashCode, which can be overwritten bei each class.

  2. No idea, but you should not care as it's an implementation detail. If you want to know it, write a sample program and measure it. But be aware that it might change in the next .Net release.

  3. Have a look at Dictionary

0

精彩评论

暂无评论...
验证码 换一张
取 消