Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. embedding dictionary withing another one?

embedding dictionary withing another one?

Scheduled Pinned Locked Moved C#
question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honeyman_can
    wrote on last edited by
    #1

    What is the syntax to embed a dictionary within another dictionary? Dictionary dicText = new Dictionary();

    D 1 Reply Last reply
    0
    • H honeyman_can

      What is the syntax to embed a dictionary within another dictionary? Dictionary dicText = new Dictionary();

      D Offline
      D Offline
      Dustin Metzgar
      wrote on last edited by
      #2

      Umm, how about this: Dictionary<string, Dictionary<string, MyClass>> dict = new Dictionary<string, Dictionary<string, MyClass>>();


      Logifusion[^]

      H 1 Reply Last reply
      0
      • D Dustin Metzgar

        Umm, how about this: Dictionary<string, Dictionary<string, MyClass>> dict = new Dictionary<string, Dictionary<string, MyClass>>();


        Logifusion[^]

        H Offline
        H Offline
        honeyman_can
        wrote on last edited by
        #3

        thanks dude. got this far, but now how do i insert into the 1st and 2nd respectively? dict.add("afdfs", ?)

        H D 2 Replies Last reply
        0
        • H honeyman_can

          thanks dude. got this far, but now how do i insert into the 1st and 2nd respectively? dict.add("afdfs", ?)

          D Offline
          D Offline
          Dustin Metzgar
          wrote on last edited by
          #4

          Well, in the embedded one you have to create a dictionary.

          dict.Add("key1", new Dictionary());
          dict["key1"].Add("key2", new MyClass(1234));


          Logifusion[^]

          1 Reply Last reply
          0
          • H honeyman_can

            thanks dude. got this far, but now how do i insert into the 1st and 2nd respectively? dict.add("afdfs", ?)

            H Offline
            H Offline
            honeyman_can
            wrote on last edited by
            #5

            don't worry I know how to do it. dict.add("asdfad", dicC.add("asdsfa","asdf") thanks anyway

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups