I'm having trouble understanding why a part of my code can't resolve another part.
I have this class that contains two properties. The second property relies on the first, but it keeps throwing this error:
cannot resolve symbol 'yearlyEmployees'
public class Financials
{
public static IEnumerable<SalaryEntity> yearlyEmployees = FactoryManagement(12345);
//cannot resolve symbol 'yearlyEmployees'
public static IEnumerable<CompanyEntity> YearlyGroup(IList<yearlyEmployees> allExempt)
{
}
}
I'm sure there's an easy answer, but I just can't find it.
Thanks!
yearlyEmployees
is a variable name, not a class name. Try:
public static IEnumerable<CompanyEntity> YearlyGroup(IList<SalaryEntity> allExempt)
That is because you don't have a type of yearlyEmplyee
- that is your variable.
Instead:
public static IEnumerable<CompanyEntity> YearlyGroup(IList<SalaryEntity> allExempt)
{ }
And then just pass a collection of SalaryEntity
to the function. If you always want to process only yearlyEmployees
(which I don't think is the case but not sure) then just call it from within the method `Financials.yearlyEmployees'.
您必须将SalaryEntity类型用作列表项。
public static IEnumerable<CompanyEntity> YearlyGroup(IList<SalaryEntity> allExempt) {}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.