Compiler Warnings vs Code Analysis
public class Team
{
private IList<Athlete> athletes;
...
}
Compiler Warning: Field Team.athletes is
never assigned to, and will always have its default value
null.
( its assigned to in my mapper layer )
public class Team
{
public Team()
{
athletes = null;
}
private IList<Athlete> athletes;
...
}
Code Analysis Warning: Team.Team()
initializes field entries of type
System.Collections.Generic.IList<Athlete> to null.
Remove this initialization as it will be done
automatically by the runtime.
What am I doing wrong here? Initializing
athletes in the Team constructor to a
new List<Athlete>() seems like a waste
since its being set/initialized in my factory.