This might be a very basic question, but really don't know how to make it. I want to create the following:
public class MyArray
{
List<KeyValuePair<int, object>> myList = new List<KeyValuePair<int, object>>();
public void Set_Value(int index, object value)
{
myList = myList.Where(a => a.Key != index).ToList();
myList.Add(new KeyValuePair<int, object>(index, value));
}
public object Get_Value(int index)
{
if (myList.Any(a => a.Key == index)) return myList.FirstOrDefault(a => a.Key == index).Value;
else return null;
}
}
class Program
{
static void Main(string[] args)
{
MyArray array = new MyArray();
array[0] = "Hello world!";
}
}
Make a array that i manipulate myself...