The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: create dictionary with c#

  1. #1

    create dictionary with c#

    hi,

    how i can create a dictionary with c#?

    thanks

  2. #2
    Code:
    Dictionary<object, string> dict = new Dictionary<object, string>();
    object myObj = new object();
    object myObj2 = new object();
    dict[myObj] = "myObj1";
    dict.Add(myObj2, "myObj2");
    
    Console.WriteLine(dict[myObj] + ' ' + dict[myObj2]);
    You don't necessary have to use object and string as your key and value types, though.
    “Who were you, Krilnon, and how did you know so much about AS4?”
    The historian sighed as she gazed up at the sky and saw… not stars. A story.

  3. #3
    There is also an article on this site that covers it: http://www.kirupa.com/net/dictionary_hashtable.htm

    Great, now even Kirupa is { facebooking | twittering }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012