如何在 vb.net 中将字典条目添加到另一个字典

How to add a dictionary entry to another dictionary in vb.net

我有这三本词典

    dictLibraries.Add("SVSU", "Zahnow Library")
    dictLibraries.Add("BR", "Fleschner Memorial Library")
    dictLibraries.Add("SDJ", "Scott D. James Technical Repository")

    dictBooks.Add("101", "Zen and the Art of Appliance Wiring")
    dictBooks.Add("102", "Interpretive Klingon Poetry")
    dictBooks.Add("103", "Doing More With Less - Navel Lint Art")
    dictBooks.Add("104", "Data Structures for Fun and Profit")
    dictBooks.Add("105", "Programming with the Bidgoli")

    dictMedia.Add("201", "CD - IEEE Computer: the Hits")
    dictMedia.Add("202", "DVD - The Pirates of Silicon Valley")
    dictMedia.Add("203", "DVD - Databases and You: the Video Experience")

那我想再做一个字典

Public mynesteddict As New Dictionary(Of String, Dictionary(Of String, String))

在这本字典里我想要 "SVSU", dictboooks("101", "Zen and the art of appliance Wiring")

我该怎么做

  1. 创建与 dictbooks 相同的字典 (dictbooks_1),
  2. 从里面的字典中复制你想要的东西,
  3. 然后将值添加到 mynesteddict

    Dim mynesteddict As New Dictionary(Of String, Dictionary(Of String, String))
    Dim dictBooks_1 As New Dictionary(Of String, String)
    dictBooks_1.Add("101", dictBooks("101"))
    mynesteddict.Add("SVSU", dictBooks_1)