An array or list of hashtables C#


Is there any way of creating a list or an array of hashtables?

What I have is a script that sends a query to a server and receives data back. Right now I’m storing the data in Lists after extracting them from the returned values.
There would be a list for:


And I would say something like:

 int index;
 for (index = 0; index < myListOfNames.Count; index++){
 print("My name is " + myListOfNames[index] + " and " + myListOfDescriptions[index]);

Since I stored them in numerical order, index 0 of names would match index 0 of description. Same with all other index. index 7 of names would correspond to index 7 of icons etc

However I want to be able to create them in a way that allows me to order them alphabetically or display only the ones with a particular name etc

I’m not sure if hashtables would be practical or not. I’d appreciate any insight on the matter.

Thanks heaps!!

create a class like this,

Class  Foo
  String name;
  Texture2D icon;
  String description;

and create a list
include this bfore that.

using System.Collections.Generic;

and in the code,

List<Foo> _fooList = new List<Foo>();

for(int i=0;i<_fooList.count;i++)
  print("My name is " + _fooList<em>.name + " and " + _fooList*.description);*</em>

I am serializing the class so that it would be visible in the editor too, so that it would be easy to add value frm scene or to debug.

public class TestDef
public string name;
public Texture2D icon;
public string description;

public class MyMain
   public TestDef[] tests;

   private Hashtable testsList;

   void Start()
      testsList = new Hashtable();
      foreach(TestDef test in TestDef)
         testsList.Add(, test);

   void SortList()
      // Do you sort algorithm on 'tests'

      // Now you can iterate through 'tests' for sorted list

   // Example for fetching by name using the Hahstable
   TestDef GetData(string byName)
      if ( testsList.ContainsKey(byName) )
         return testsList[byName];

      return null;