在 VB.NET 中创建可搜索 "array" 的最有效方式
Most efficient way to create searchable "array" in VB.NET
我想创建一个VB.NET中的一些描述的多维数组,可以高效地存储和搜索以下数据(搜索第二个维度,return第一个)。
Folder
Ext
excel
xls
excel
xlsx
word
doc
word
docx
powerpoint
ppt
powerpoint
pptx
Dim data As New Dictionary(Of String, String) From {
{"xls", "excel"},
{"xlsx", "excel"},
{"doc", "word"},
{"docx", "word"},
{"ppt", "powerpoint"},
{"pptx", "powerpoint"}
}
像这样访问它:
Dim ext As String = "docx"
Dim folder As String = data(ext)
我想创建一个VB.NET中的一些描述的多维数组,可以高效地存储和搜索以下数据(搜索第二个维度,return第一个)。
Folder | Ext |
---|---|
excel | xls |
excel | xlsx |
word | doc |
word | docx |
powerpoint | ppt |
powerpoint | pptx |
Dim data As New Dictionary(Of String, String) From {
{"xls", "excel"},
{"xlsx", "excel"},
{"doc", "word"},
{"docx", "word"},
{"ppt", "powerpoint"},
{"pptx", "powerpoint"}
}
像这样访问它:
Dim ext As String = "docx"
Dim folder As String = data(ext)