I have a small program below
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var obj = new {
date = "Now",
arr = animals
};
var obj2 = new {
date = "later",
arr = animals
};
var obj3 = new {
date = "Never",
arr = animals
};
var getVal = obj.date;
Object [] x = {obj, obj2, obj3};
Dictionary<string, Object []> myDict;
myDict = new Dictionary<string, Object []>()
{
{"length", x},
};
var getVal2 = myDict["length"][1];
// var getVal2 = myDict["length"][1].date; error no method date
Console.WriteLine(getVal);
Console.WriteLine(getVal2);
}
}
How would I use getVal2 to get a date attribute from my object array. Accessing it outside the dictionary works fine from the variable: getVal and gives back the string "Now". How do I go about it for getVal2? Thanks