I have a collection from a api call where i have field called links, as below image
Now I need to loop through these 100 records like this and match with the company number that i have.
To achieve this i Have written below code but that does not work
<code> var company_number="12345678";
var abc = newAppointmentList.items
.Where(a => a.links.company.Split('/')[2] == company_number)
.FirstOrDefault()
if(abc != null)
{
//insert that record only
}
</code>
<code> var company_number="12345678";
var abc = newAppointmentList.items
.Where(a => a.links.company.Split('/')[2] == company_number)
.FirstOrDefault()
if(abc != null)
{
//insert that record only
}
</code>
var company_number="12345678";
var abc = newAppointmentList.items
.Where(a => a.links.company.Split('/')[2] == company_number)
.FirstOrDefault()
if(abc != null)
{
//insert that record only
}
I have also tried the other way
<code>var company_number="12345678";
var abc = newAppointmentList.items
.Where(a => a.links.company.Contains(company_number))
.FirstOrDefault()
if(abc != null)
{
//insert that record only
}
</code>
<code>var company_number="12345678";
var abc = newAppointmentList.items
.Where(a => a.links.company.Contains(company_number))
.FirstOrDefault()
if(abc != null)
{
//insert that record only
}
</code>
var company_number="12345678";
var abc = newAppointmentList.items
.Where(a => a.links.company.Contains(company_number))
.FirstOrDefault()
if(abc != null)
{
//insert that record only
}
both code not matching any record while i have data for the same from api .
6