One option is to simply use the Collection type directly from C #. This is the standard assembly type of Microsoft.VisualBasic.dll and can be used from any .Net language.
The closest collection in the standard BCL, however, is Hashtable . The conversion between Hashtable and Collection should be pretty straight forward.
for example
using VBCollection = Microsoft.VisualBasic.Collection; ... public static VBCollection ToVBCollection(this Hashtable table) { var collection = new VBCollection(); foreach (var pair in table) { // Note: The Add method in collection takes value then key. collection.Add(pair.Value, pair.Key); } return collection; }
Note. However, this is not a direct mapping. The Collection type supports a number of operations that the Hashtable does not like: before and after values, an index by number or key, etc. My approach would be to consistently use one type throughout the application and change either C # or the VB project accordingly
Jaredpar
source share