我有這樣的對象,像這樣[ { job: "ABC-123", task: "XYZ" }, { job: "ABC-333", task: "LAX" }];
asp.net得到一個循環從列表項
這個對象是從一個AJAX調用這裏:
public List<VendorUpdateClass> updateVendorItem(List<VendorUpdateClass> edittedItems)
{
ConnectionClass jobs = new ConnectionClass();
return jobs.updateVendors(edittedItems);
}
它調用這個類:
public List<VendorUpdateClass> updateVendors(List<VendorUpdateClass> items)
{
VendorUpdateCell = new List<VendorUpdateClass>();
foreach (object objectItems in items)
{
VendorUpdateClass vendorUpdatedItem = new VendorUpdateClass();
vendorUpdatedItem.job = objectItems.job;
vendorUpdatedItem.task = objectItems.job;
vendorUpdatedItem.vendor = objectItems.task;
VendorUpdateCell.Add(vendorUpdatedItem);
}
return VendorUpdateCell;
}
我的問題是我的循環。我試圖從分配的對象vendorUpdatedItem
這裏job
和task
是我收到的錯誤:
'object' does not contain a definition for 'job' and no extension method 'job' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
我在做什麼錯?