Click here to Skip to main content
15,924,507 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 21:58
N a v a n e e t h26-May-08 21:58 
GeneralRe: Getting key from the value Pin
leppie26-May-08 23:03
leppie26-May-08 23:03 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 23:12
N a v a n e e t h26-May-08 23:12 
GeneralRe: Getting key from the value Pin
Guffa26-May-08 23:07
Guffa26-May-08 23:07 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 23:49
N a v a n e e t h26-May-08 23:49 
GeneralRe: Getting key from the value Pin
Guffa27-May-08 0:14
Guffa27-May-08 0:14 
GeneralRe: Getting key from the value Pin
N a v a n e e t h27-May-08 0:46
N a v a n e e t h27-May-08 0:46 
GeneralRe: Getting key from the value Pin
Guffa27-May-08 1:47
Guffa27-May-08 1:47 
A dictionary contains two arrays, a bucket index array and an entry array. The bucket index array is an int array and the entry array is an array of the type Entry:
[StructLayout(LayoutKind.Sequential)]
private struct Entry {
    public int hashCode;
    public int next;
    public TKey key;
    public TValue value;
}

If the key and the value are reference types, on a 32-bit system the Entry structure will be 4+4+4+4 = 16 bytes. The two arrays always has the same number of items, so for each entry there is one item in the bucket index array (int) and one item in the entry array, which will add up to 20 bytes in this case.

The size of the Entry structure varies depending on the system and data types. For example:

On a 64-bit system, if the key and value are reference types, the Entry structure will be 4+4+8+8 = 24 bytes.

If the key is an Int64 and the value is a Decimal, the Entry structure will be 4+4+8+16 = 32 bytes.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Getting key from the value Pin
N a v a n e e t h27-May-08 6:15
N a v a n e e t h27-May-08 6:15 
AnswerRe: Getting key from the value Pin
S. Senthil Kumar26-May-08 22:33
S. Senthil Kumar26-May-08 22:33 
GeneralRe: Getting key from the value Pin
N a v a n e e t h26-May-08 22:39
N a v a n e e t h26-May-08 22:39 
QuestionCompression... Pin
Reelix26-May-08 20:36
Reelix26-May-08 20:36 
AnswerRe: Compression... Pin
Guffa26-May-08 21:47
Guffa26-May-08 21:47 
GeneralRe: Compression... Pin
Reelix26-May-08 22:02
Reelix26-May-08 22:02 
GeneralRe: Compression... Pin
Guffa26-May-08 23:17
Guffa26-May-08 23:17 
QuestionAdding presentationcode.dll as a reference to a project Pin
Chesnokov Yuriy26-May-08 20:31
professionalChesnokov Yuriy26-May-08 20:31 
QuestionHow to correct error Pin
usmanehsan26-May-08 20:22
usmanehsan26-May-08 20:22 
AnswerRe: How to correct error Pin
Nouman Bhatti26-May-08 20:26
Nouman Bhatti26-May-08 20:26 
QuestionHow to run your C# Application as Administrator in Vista? Pin
lovnin26-May-08 19:51
lovnin26-May-08 19:51 
AnswerRe: How to run your C# Application as Administrator in Vista? Pin
mav.northwind27-May-08 3:36
mav.northwind27-May-08 3:36 
QuestionHow to restrict other users to update the data, while one is doing updation in disconnected mode of database Pin
Krish Agn26-May-08 19:21
Krish Agn26-May-08 19:21 
AnswerRe: How to restrict other users to update the data, while one is doing updation in disconnected mode of database Pin
Ashfield26-May-08 21:20
Ashfield26-May-08 21:20 
GeneralRe: How to restrict other users to update the data, while one is doing updation in disconnected mode of database Pin
Krish Agn26-May-08 22:59
Krish Agn26-May-08 22:59 
GeneralRe: How to restrict other users to update the data, while one is doing updation in disconnected mode of database Pin
Ashfield27-May-08 21:50
Ashfield27-May-08 21:50 
Questionconvert C# 2005 Express Solution to Pro Pin
half-life26-May-08 19:17
half-life26-May-08 19:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.