I want to convert a datarow[]
into a List<int>
List<int> UserIds;
public void GetGravatars()
{
var cmd = access.GetSqlCommandStoredProcedure("uspMembershipGetUserGravatarList");
var table = access.ExecuteDataTable(cmd, DAL.Logic.Common.ConnectionStrings.User);
int[] rows = new int[table.Rows.Count];
table.Rows.CopyTo(rows, 0);
UserIds = rows.ToList<int>();
}
public bool UserHasGravatar(int userId)
{
UserIds.Find(
delegate(int i)
{
return i == userId;
}
);
return false;
}
What is the best way of doing this?
Edit: My code needs to loop through a list of users, about 40000, and update their image, if they dont have one, so I thought it would be quickest, to load all the userids with images into a List, then check that against all userids in the database, if userid doesnt exists, then update image, otherwise continue.