I would like to create a multidimensional array of some description in VB.NET that can store and search the following data efficiently (search on the second dimension, to return the first).
| Folder | Ext |
|---|---|
| excel | xls |
| excel | xlsx |
| word | doc |
| word | docx |
| powerpoint | ppt |
| powerpoint | pptx |
>Solution :
Dim data As New Dictionary(Of String, String) From {
{"xls", "excel"},
{"xlsx", "excel"},
{"doc", "word"},
{"docx", "word"},
{"ppt", "powerpoint"},
{"pptx", "powerpoint"}
}
Access it like this:
Dim ext As String = "docx"
Dim folder As String = data(ext)