"bill tie" wrote...
>
I'm trying to re-construct missing classes in somebody else's code.
Salient points:
Dictionary<string, Projectprojects = new Dictionary<string, Project>();
...
WeeklyAggregation aggregation = new WeeklyAggregation();
...
aggregation.Project = new Project[projects.Count]; <--- What is this?
From the code you provided, we can deduce that the class WeeklyAggregation
has a member called "Project", which has the type Project[] (array of
project).
The size of that array will be the number of values in the Dictionary
project, at this point.
If we assume that the coder has followed normal naming guidelines, we can
assume that it's a property, which could be implemented as:
class WeeklyAggregation
{
private Project[] projects;
public Project[] Project
{
get { return projects; }
set { projects = value; }
}
...
}
The following line then simply copies the values of the Dictionary into the
array.
projects.Values.CopyTo(aggregation.Project, 0);
....and in the following statement, my guess is that you have misspelled
something...
foreach (projects project in aggregation.Project)
{
...
}
Shouldn't it be...
foreach (Project project in aggregation.Project)
{
...
}
?
The classes I'm re-constructing from the rest of the code are:
- WeeklyAggregation
- Project
Can anybody explain and suggest how I should define parts relevant to the
code above, in the two classes?
The thing we can deduce from the code you provided is what I wrote above,
i.e. that there must be a member "Project" in the class WeeklyAggregation.
The code doesn't say anything about the contents of the class Project.
Thank you.
You're welcome.
// Bjorn A