User Profile

Collapse

Profile Sidebar

Collapse
whosaidwhat
whosaidwhat
Last Activity: Sep 20 '10, 02:43 AM
Joined: Mar 31 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How I am trying to get values from the Dictionary by way of dictionary[KEY] is correct and works. In your example and the examples from MSDN the TKey is a string, or some other non-collection type. With my example the TKey is a byte array, this is what is required in my actual application.

    As I have tried to show in my first example, I can retrive the value for an entry easily when I specify the exact byte[] that I added to the dictionary....
    See more | Go to post

    Leave a comment:


  • I do apologize I am having difficulty desribing the problem from a third party point of view and I am assuming too much.

    Referring to the example provided:

    Actual result: "string result3 = dictionary[bytes2];" Throws an error, saying it cannot find the entry.

    Expected result: "string result3 = dictionary[bytes2]; " Returns "hello" and puts it into result3, this is what I want...
    See more | Go to post

    Leave a comment:


  • I want the Dictionary to be able to search for the key byte[] by the values contained in it. I want bytes2 array (used in my provided example) to match a entry in the Dictionary because its values are contained in a key in the Dictionary.
    See more | Go to post

    Leave a comment:


  • Using collections as key in Dictionary<TKey, TValue>

    Hello, I am creating a program that has a byte[] used as the key for a Dictionary class. The problem is best described with an example:

    (C# example of problem)
    Code:
            private Dictionary<byte[], string> dictionary;
    
            public void Method1()
            {
                // Set up the dictionary
                dictionary = new Dictionary<byte[], string>();
                byte[]
    ...
    See more | Go to post
No activity results to display
Show More
Working...