Solved

VB.NET list to dictionnary

Posted on 2015-02-11
2
126 Views
Last Modified: 2015-02-11
Hello EE,

I got a list in vb.net  of strings

something like ;

01
3
02
9
03
1
04
0
05
5
06
8
07
1
08
1
etc...


it goes like that up to 100.  you see the pattern here.. actually its the number 01 to 100 and between them i have a value.
I would like to convert this to a dictionnary so that the key is the number 01 to 100 and the value is the value in between from the list...

can you help ?
thanks
0
Comment
Question by:PhilippeRenaud
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40604141
Honestly, I think spelling this out in an old-skool For loop would be the easiest to read and understand.

e.g.

Module Module1

    Sub Main()
        Dim originalList As New List(Of String) From
        {
            "01",
            "3",
            "02",
            "9",
            "03",
            "1",
            "04",
            "0",
            "05",
            "5",
            "06",
            "8",
            "07",
            "1",
            "08",
            "1"
        }
        Dim theDictionary As New Dictionary(Of String, String)()

        For i As Integer = 0 To originalList.Count - 1 Step 2
            theDictionary.Add(originalList(i), originalList(i + 1))
        Next

        System.Diagnostics.Debugger.Break()
    End Sub

End Module

Open in new window

0
 
LVL 1

Author Closing Comment

by:PhilippeRenaud
ID: 40604152
Yup, I just thought to that and was about to delete my question haha.

Thank you Kaufmed =)
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question