I want to know what is the difference between the following two code snippets while getting list from sharepoint
SPList list = oSPWeb.Lists["MyList"]; //Add a new item in the List SPListItem itemToAdd = list.Items.Add(); itemToAdd["Title"] = "Test Title"; itemToAdd["Description"] = "Test Description"; itemToAdd.Update();
and
SPListItemCollection listItemsCol = myweb.Lists["Employee_Details"].Items; SPListItem item = listItemsCol.Add(); item["EmployeeName"] = txtEmployeeName.Text; item["Title"] = txtDesi.Text; item["EmployeeID"] = Convert.ToInt32(txtEmployeeID.Text); item.Update();
Why first code snippet uses only SPList to get sharePoint list
and in second code snippet why we used SPListItemCollection?