I’m trying to select a job based on the job number given, if that number matches that of what’s in the job, bingo, return it. Should be simple stuff but I’m seeing an error I’ve not seen before.
I have similar methods using this same technique to pull other details but for some reason this just isn’t working. All I could think is that it was a Getter/Setter issue, but I have looked and can’t make it out.
If anyone has any idea, I would greatly appreciate it. Thanks.
The error I’m receiving is on this line of code, the error follows:
if (j.JobNum.Equals(JobRef, StringComparison.OrdinalIgnoreCase))
JobSet.Add(j);
‘object.Equals(object, object)’ cannot be accessed with an instance reference; qualify it with a type name instead.
The method is shown here:
public List<Job> SelectJob(String JobRef)
{
List<Job> JobSet = new List<Job>();
foreach (Job j in Jobs)
{
if (j.JobNum.Equals(JobRef, StringComparison.OrdinalIgnoreCase))
JobSet.Add(j);
}
return JobSet;
}
Change it
to
Because
JobNumis type ofintor any other number data type.