Considering:
Dictionary<string,Object> dict = new Dictionary<string,Object>();
dict.Add("Name","deadlock");
dict.Add("Birthday",new BD(12,12,1955));
Knowing that BD is:
public class BD {
public int Day {get; set; }
public int Month {get; set; }
public int Year {get; set;}
public BD(int x,int y,int z) { Day=x; Month=y; Year=z; }
}
My problem is that I can’t reference Day,Month,Year from the dictionary like that:
int Day1 = dict["Birthday"].Day;
The above code won’t work. Any suggestions are welcome.
You need to cast it into a BD object.