I have this repeated code below and I am assuming that this can be consolidated but if you notice each dictionary is different generic dictionary:
dictionary1 is of type
Dictionary<int, ContinuousIntegrationSolution>
whereas dictionary2 is of type:
Dictionary<int, BugTracker>
DataTable dt = GetDataTable("CI");
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
int id = Convert.ToInt32(dr["id"]);
string name = dr["name"].ToString();
_dictionary1[id] = new ContinuousIntegrationSolution(){Name = name};
}
DataTable dt1 = GetDataTable("Bug_Tracking");
for (int i = 0; i < dt1.Rows.Count; i++)
{
DataRow dr = dt1.Rows[i];
int id = Convert.ToInt32(dr["id"]);
string name = dr["name"].ToString();
_dictionary2[id] = new BugTracker() { Name = name };
}
DataTable dt2 = GetDataTable("SDLC");
for (int i = 0; i < dt2.Rows.Count; i++)
{
DataRow dr = dt2.Rows[i];
int id = Convert.ToInt32(dr["id"]);
string name = dr["name"].ToString();
_dictionary3[id] = new SDLCProcess() { Name = name };
}
NOTE: I have fixed the few typos that were mentioned below.