Is it possible to create the one described in the title? In PHP, everything is fine with arrays, and in VS2017 it is somehow sad, at least using standard methods.

  • 2
    In puff everything is bad in arrays, they are not there. Instead, some kind of combine, similar to MAP. - D-side
  • All "beautiful" implementations of an arbitrary index use hash tables , so do not forget about the issue price - Yuri Negometyanov
  • @ D-side Awesome amenities, really. But then it turns out how long the “optimal” algorithm works ... - Yuri Negometyanov
  • @YuriNegometyanov is fine, if it is convenient, but we must understand that this is not an array. Just yesterday, a person suggested (in another language) adding an element by string index to an array and was very surprised to learn that this could not be done. - D-side
  • @ D-side I'm talking about the possibility of "beautiful" decisions like this . But they can hardly be called fast, if you think about the actual implementation. - Yuri Negometyanov

1 answer 1

VB has the equivalent of this Dictionary:

Dim dict = New Dictionary(Of String, String) dict.Add("value1", "0001") dict.Add("value2", "0010") 

Or one line

 Dim variable As New Dictionary(Of String, String) From { {"0001", "value1"}, {"0010", "value2"} } 

You can get the values ​​by keys:

 Dim val2 = dict("value2") ' <-- 0010